在nginx上使用http2协议(常规的http到Wildfly 10后端)时,我遇到了一个nginx在将头文件丢到后端的问题。 下面的configuration工作时采取http2参数,当http2参数启用,前端似乎工作,但后端没有收到客户端的任何头。 我也尝试添加:proxy_http_version 1.1 – 参数没有效果。
nginx到后台连接是否也需要使用http2协议来传递标头? 我明白,只使用http2到nginx前端是一个常见的用例。
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; } }