server {
listen 443 ssl;
server_name localhost;
ssl on;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
location /bla/ {
proxy_set_header Host localhost;
proxy_set_header SCRIPT_NAME /bla;
proxy_set_header X-Forwarded-Host localhost;
proxy_set_header X-Forwarded-Proto https;
}
location / {
proxy_redirect off;
}
}
Everything works as expected except for the scheme part of url generation. Calls to static_url in the templates (using pyramid_jinja2 2.1) produce correct URLs except that they use an HTTP scheme. Calls to route_url in the templates produce correct URLs including the scheme. Calls to route_url in python view code produce URLs with incorrect HTTP scheme. Adding a handler for the NewRequest event fixes this issue, like this: