ccarney16 / pterodactyl-containers

Pterodactyl Panel within a docker container
230 stars 78 forks source link

Mixed content, reverse proxy setup #113

Open Aeris1One opened 3 years ago

Aeris1One commented 3 years ago

Hi, I used --panel --database and modified docker-compose.yml to have the proxy container a fixed local ip (172.40.0.2) and not exposing ports 80 and 443. I have a bare-metal insalled nginx with ProxyPass panel.mydomain.com to 172.40.0.2:80 and handle all the SSL thing. A problem is that when accessing https://panel.mydomain.com it works well (can login and visit all pages) but I can't create locations because of Mixed content, the page simply reloads without creating the location : image

My Nginx config is :

    server_name  panel.domain.com;
    access_log off;
    location / {
        proxy_pass http://172.40.0.2:80;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_redirect off;
        proxy_buffering off;
        proxy_request_buffering off;
        port_in_redirect off;
        proxy_connect_timeout 300;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/panel.domain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/panel.domain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = panel.atrenia.fr) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen   80;
    server_name  panel.domain.com;
    return 404; # managed by Certbot
}

Also, in my conf.d/panel.env shows the good APP_URL=https://panel.domain.com/

That's not really an issue from pterodactyl-containers, I'm just asking for help because I basically don't know what i'm doing wrong :/

TekExplorer commented 3 years ago

Make sure your panel .env config has https and not http.

On Wed, Jun 30, 2021, 7:26 AM Aeris One @.***> wrote:

Hi, I used --panel --database and modified docker-compose.yml to have the proxy container a fixed local ip (172.40.0.2) and not exposing ports 80 and

  1. I have a bare-metal insalled nginx with ProxyPass panel.mydomain.com to 172.40.0.2:80 and handle all the SSL thing. A problem is that when accessing https://panel.mydomain.com it works well (can login and visit all pages) but I can't create locations because of Mixed content, the page simply reloads without creating the location : [image: image] https://user-images.githubusercontent.com/29739547/123952080-cbfb3000-d9a5-11eb-9295-e629b371ad3f.png

My Nginx config is :

server_name panel.atrenia.fr; access_log off; location / { proxy_pass http://172.40.0.2:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_redirect off; proxy_buffering off; proxy_request_buffering off; port_in_redirect off; proxy_connect_timeout 300; }

listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/panel.domain.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/panel.domain.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot }

server { if ($host = panel.atrenia.fr) { return 301 https://$host$request_uri; } # managed by Certbot

listen 80; server_name panel.atrenia.fr; return 404; # managed by Certbot }```

That's not really an issue from pterodactyl-containers, I'm just asking for help because I basically don't know what i'm doing wrong :/

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ccarney16/pterodactyl-containers/issues/113, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHHDKZSFECYE6WFREBTIE43TVL5NPANCNFSM47SECEEA .

Aeris1One commented 3 years ago

Also, in my conf.d/panel.env shows the good APP_URL=https://panel.domain.com/

Yeah, I already verified, it's ok but there remains some http links :/

BIackHornet commented 2 years ago

Try adding the following line to your nginx config for this site, and restart nginx. In the location / block:

add_header Content-Security-Policy upgrade-insecure-requests;

Your should also run all your sites through https://securityheaders.com/ and increase your sites security with its recommendations.