I've encoutered a problem with nginx losing headers to backend when using http2 protocol on nginx(regular http to Wildfly 10 backend). The below config works when taking the http2 parameter away and when the http2 parameter is enabled, the frontend seemingly works but backend is not receiving any headers from client. I also tried adding: proxy_http_version 1.1 -parameter with no effect.
Does the nginx to backend connection also need to use http2 protocol for headers to pass? I have understood that it's a common use-case to only use http2 up to nginx frontend.
upstream backend {
# Use IP Hash for session persistence
ip_hash;
# List of Wildfly application servers
server backend:8080;
}
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name site.domain.com;
keepalive_timeout 70;
# Proxy settings
proxy_read_timeout 120;
proxy_set_header Host $http_host;
proxy_pass_request_headers on;
underscores_in_headers on;
# SSL settings
ssl on;
ssl_certificate /etc/ssl/cert.crt;
ssl_certificate_key /etc/ssl/key.key;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_session_timeout 30m;
ssl_protocols TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
location / {
return 404;
}
location /WebContext {
proxy_pass http://backend;
}
}