Starbix / docker-synclounge

🐳 Dockerfile for SyncLounge
https://synclounge.tv
MIT License
19 stars 5 forks source link

Web App Self-redirecting #2

Closed kitce closed 6 years ago

kitce commented 6 years ago

My nginx configuration:

server {
    listen 443;
    server_name my.server.domain;
    ssl on;
    ssl_certificate         /path/to/ssl/cert.pem;
    ssl_certificate_key     /path/to/ssl/key.pem;
    location /slweb {
        proxy_pass http://SyncLounge:8088/slweb;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    location /slserver {
        proxy_pass http://SyncLounge:8089/slserver;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
    }
    location / {
        proxy_pass http://SyncLounge:8088/slweb;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Image tag : latest Image ID : 5894e58eef1e

Browser : Google Chrome

When I visit https://my.server.domain/slweb, the browser gets redirected to https://my.server.domain, then it gets self-redirected for 18 times, finally, the browser shows ERR_TOO_MANY_REDIRECTS error.

samcm commented 6 years ago

Im currently updating the Dockerfiles for the large changes in v2 that were just pushed to master in Synclounge. Will be done soon, sorry.

kitce commented 6 years ago

Thanks for the maintenance.

Does it mean that the current images are not usable at this moment?

samcm commented 6 years ago

At the moment yeah, shouldn't be much longer.

samcm commented 6 years ago

I've just merged the changes - I'm not a Docker wizard by any means but it will hopefully be functional for now. Webroots & serverroots are optional in v2. With your current nginx.conf you should set these Env Variables when you run the image:

webroot -> /slweb serverroot -> /slserver

I'll document all of these changes over the weekend but that should be enough to get you going :)

Edit: Dockerhub is still building the images

kitce commented 6 years ago

I just updated the image to 1457555a9a76 and set webroot=/slweb, serverroot=/slserver to start the image.

It seems the self-redirecting issue is solved, but the browser shows an blank page when I visit https://my.server.domain/slweb

On the other hand, I tried to use custom server on the official SyncLounge web app, but got Failed to connect to https://my.server.domain

samcm commented 6 years ago

I believe the first issue will be fixed when this current set of images is built.

The custom server will work as well once I have a minute to update the official web app. I've removed the automatic /slserver appending within the web app so you'll have to put that at the end of your custom server url :)

kitce commented 6 years ago

It works after updating the image. Thank you.

I am now trying to make https://my.server.domain works for custom server without appending /slserver. This was how I use it before version 2.

samcm commented 6 years ago

No worries!

You'll most likely need a separate sub-domain for that, as / requests will route to the web app without it.

kitce commented 6 years ago

I am having a weird behavior.

If I set the env and proxy_pass to /slweb and /slserver, I can't access to https://my.server.domain/slweb due to some JS and CSS files get proxied to the SyncLounge server, they responded You've connected to the SLServer, you're probably looking for the webapp..

But I am sure that this message is not responded from my custom nginx server, because I tried to only enable /slweb route in nginx, those JS and CSS files still respond the same message.

However, if I set the env and proxy_pass to /web and /server, everything seems to work fine.

kitce commented 6 years ago

Finally, I set webroot=/web and serverroot= (empty string).

This is my nginx configuration :

location /web {
    proxy_pass http://SyncLounge:8088/web;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}
location / {
    proxy_pass http://SyncLounge:8089;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
}

I can successfully access to the web app on https://my.server.domain/web and connect to custom server with the url https://my.server.domain.

samcm commented 6 years ago

Nice work! Sorry it's a little convoluted to get going at the moment, I'll try to get some documentation out this weekend.

Closing this for now :)