styxit / HTPC-Manager

A fully responsive interface to manage all your favorite software on your Htpc.
http://htpc.io
MIT License
530 stars 183 forks source link

Login redirects to localhost #374

Closed the4tress closed 8 years ago

the4tress commented 8 years ago

I'm using nginx as a reverse proxy for my HTPC-Manager setup. Every time it redirects me to the login page it changes the url to localhost:8085 instead of the actual domain. This also happens after I log in.

Any ideas how to fix this?

Thanks!

Hellowlol commented 8 years ago

Sounds like a messed up nginx config. Can you post you config?

the4tress commented 8 years ago
upstream htpcman { server localhost:8091; }

server {
    listen            443 ssl;
    server_name       my.domain.com;

    ssl_certificate /etc/letsencrypt/live/my.domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/my.domain.com/privkey.pem;
    ssl_session_timeout 5m;
    ssl_session_cache shared:SSL:1m;

    ssl_protocols TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';
    ssl_prefer_server_ciphers on;

    add_header Strict-Transport-Security max-age=15768000;

    ssl_stapling on;
    ssl_stapling_verify on;

    ## verify chain of trust of OCSP response using Root CA and Intermediate certs
    ssl_trusted_certificate /etc/letsencrypt/live/my.domain.com/chain.pem;
    resolver 8.8.8.8 8.8.4.4 valid=86400;
    resolver_timeout 10; # tuning
    keepalive_requests 100000;

    # Only allow these request methods
    if ($request_method !~ ^(DELETE|GET|HEAD|OPTOINS|POST|PUT)$) {
        return 444;
    }

    #---------------------------------------------
    # HTPC Manager                               |
    #---------------------------------------------
    location / {
        proxy_pass          http://htpcman/;
        proxy_set_header    Host localhost:8091;
        proxy_redirect      default;
        # proxy_set_header    X-Real-IP $remote_addr;
        # proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        # proxy_set_header    X-Forwarded-Proto $scheme;

        proxy_http_version  1.1;
    }

    #---------------------------------------------
    # default proxy timeout                      |
    #---------------------------------------------
    proxy_connect_timeout   60;
    proxy_send_timeout      60;
    proxy_read_timeout      300;
}
Hellowlol commented 8 years ago

try:

location / {
                proxy_pass http://htpcman/;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
the4tress commented 8 years ago

That worked.

Thanks!

Hellowlol commented 8 years ago

Np! happy to help :)