Eu também consegui resolver o primeiro problema. A razão para esse comportamento estranho foi causada porque o proxy reverso caiu a parte de consulta da solicitação (tudo por trás do?). Isso novamente foi causado por linhas proxy_pass configuradas incorretamente.
A solução para isso foi remover /$uri
das duas linhas proxy_pass no arquivo de configuração (veja detalhes link ).
Esta é uma solução funcional:
ssl_certificate /etc/nginx/certs/gateway.example.com.crt;
ssl_certificate_key /etc/nginx/certs/gateway.example.com.key;
ssl_dhparam /etc/nginx/certs/dh.pem;
ssl_protocols TLSv1.2 TLSv1.1;
ssl_ciphers AES256+EECDH:AES128+EECDH:!aNULL:!eNULL:!ECDSA:!SHA:!DSS;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
server { # http
server_name gateway.example.com localhost 1.2.3.4;
listen *:80;
root /usr/share/nginx/html;
location / {
index index.html;
}
location ~ ^/dashboard {
return 302 'https://$host$request_uri';
}
location ~ ^/console {
return 302 'https://$host:6080$request_uri';
}
location ~ ^/websockify {
return 302 'https://$host:6080$request_uri';
}
}
server { # https
server_name gateway.example.com localhost 1.2.3.4;
listen *:443;
ssl on;
location / {
sub_filter ''http://10.24.7.9'' ''https://$host'';
sub_filter ''http://$host'' ''https://$host'';
sub_filter_last_modified on;
sub_filter_once off;
sub_filter_types *;
proxy_pass 'http://10.24.7.9';
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header Origin 'http://$host';
proxy_set_header Accept-Encoding "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
}
}
server { # https on port 6080 for novnc
server_name gateway.example.com localhost 1.2.3.4;
listen *:6080;
ssl on;
location / {
proxy_pass 'http://10.24.7.9:6080';
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header Origin 'http://$host';
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_connect_timeout 90;
# proxy_send_timeout 90;
# proxy_read_timeout 90;
}
}