H
H
Human2016-09-30 12:24:54
Nginx
Human, 2016-09-30 12:24:54

How not to pass location to nginx?

Hello.
I'm proxying, I'm proxying, but it's not being proxied.
Here is the config I have:

upstream proxmoxvar {
        ip_hash;
        server XXX.XX.XXX.XX:8006;
        keepalive 1;
}

server {
        listen 80;
        server_name mgmt.somedomain.corp;
        return 301 https://$server_name$request_uri;
}
server {
                server_name mgmt.somedomain.corp;
                listen 443;
                ssl on;
                ssl_certificate /etc/letsencrypt/live/mgmt.somedomain.corp/fullchain.pem;
                ssl_certificate_key /etc/letsencrypt/live/mgmt.somedomain.corp/privkey.pem;
                ssl_dhparam /etc/ssl/certs/dhparam.pem;
                ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
                ssl_prefer_server_ciphers on;
                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:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
                ssl_session_timeout 1d;
                ssl_session_cache shared:SSL:50m;
                ssl_stapling on;
                ssl_stapling_verify on;
                add_header Strict-Transport-Security "max-age=604800; includeSubDomains; preload;";
                add_header X-Content-Type-Options nosniff;
                add_header X-Frame-Options "SAMEORIGIN";
                add_header X-XSS-Protection "1; mode=block";
                add_header X-Robots-Tag none;
                add_header X-Download-Options noopen;
                add_header X-Permitted-Cross-Domain-Policies none;
                proxy_redirect off;
        resolver 8.8.8.8 8.8.4.4 valid=300s;
        resolver_timeout 5s;
        
    location / {
                proxy_set_header X-Forwarded-Proto https;
                proxy_pass https://proxmoxvar;
                proxy_http_version 1.1;
                proxy_set_header Connection $http_connection;
                proxy_set_header Origin http://$host;
                proxy_set_header Upgrade $http_upgrade;
        }
}

everything works but i want to use mgmt.somedomain.corp not only to manage just one proxmox
but when i change to
location /proxmox {
                proxy_set_header X-Forwarded-Proto https;
                proxy_pass https://proxmoxvar;
                proxy_http_version 1.1;
                proxy_set_header Connection $http_connection;
                proxy_set_header Origin http://$host;
                proxy_set_header Upgrade $http_upgrade;
        }

That stops working, because far, far away on the host XXX.XX.XXX.XX in access.log I see that all requests start with / proxmox, and not with / as expected. How to deal with it? how not to pass this location to the other side?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Shatokhin, 2016-09-30
of Humans @tenhi_shadow

Replace
proxy_pass with https://proxmoxvar;
on
proxy_pass https://proxmoxvar/;

S
Sergey Savostin, 2016-09-30
@savostin

rewrite?

A
Alexander Manakov, 2016-10-06
@gogolor

In the console it says "$ is not defined", jQuery seems to be badly connected)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question