DomiStyle / docker-idrac6

iDRAC 6 web interface and VNC proxy
https://hub.docker.com/r/domistyle/idrac6/
MIT License
778 stars 142 forks source link

Can't proxy via Nginx? #16

Closed firestormv1 closed 5 years ago

firestormv1 commented 5 years ago

I've got the container running and accessing it via docker-master:5800 works as expected however when I try to proxy through Nginx on port 80, the UI shows an X next to the "IDRAC6" text in the upper left hand corner. When I access via port 5800, I get an unlocked padlock icon and it works as expected.

Is there something specific that won't work if the application is proxied via Nginx?

(For some reason, code formatting doesn't work and github is stripping out the spacing. Nginx config below)

server {
listen 80;
listen [::]:80;
server_name drac.docker-master.local;
location / {
proxy_pass http://127.0.0.1:5800/;
}
access_log /var/log/nginx/access_drac.docker-master.log;
error_log /var/log/nginx/error_drac.docker-master.log;
}

Suggestions are appreciated, thank you.

DomiStyle commented 5 years ago

I'm running multiple instances behind a reverse proxy.

Two things you can try:

firestormv1 commented 5 years ago

Tried changing the slash at the end of the proxy pass statement, no change.

Tried adding the proxy_params directive and this broke nginx config. I don't think it exists in my configuration.

Tried defining proxy_params from a "generic" configuration and didn't change anything (except allowed nginx to start).

DomiStyle commented 5 years ago

This is the configuration I use:

/etc/nginx/conf.d/proxy.conf:

map $http_x_forwarded_proto $proxy_x_forwarded_proto
{
    default $http_x_forwarded_proto;
    '' $scheme;
}
map $http_upgrade $proxy_connection
{
    default upgrade;
    '' close;
}

/etc/nginx/proxy_params:

proxy_http_version 1.1;
proxy_buffering off;

proxy_set_header Host $host;
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 $proxy_x_forwarded_proto;

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;

proxy_set_header Proxy "";

proxy_read_timeout 1d;

/etc/nginx/sites-available/srv1.idrac.example.org:

server
{
    #include listen.conf;
    server_name srv1.idrac.example.org;

    #include headers.conf;
    #include ssl_headers.conf;
    #include ssl.conf;

    #ssl_certificate /certs/idrac.example.org/fullchain.pem;
    #ssl_certificate_key /certs/idrac.example.org/privkey.pem;

    #include auth_sso.conf;
    include proxy_params;

    location /
    {
        proxy_pass http://node01.example.org:5801;
    }
}

I commented out the HTTPS parts, just need to add a listen for port 80 and adjust your upstream host.

firestormv1 commented 5 years ago

Excellent! That works! Thank you for the help! I really appreciate it.

Just in case anyone comes behind me and asks the same question, be careful of the proxy.conf file. The line that reads ''$scheme; and ''close; have a space between the single quotes and the keywords. Github butchered the output.