nginx反向代理将自定义headers发送到后端应用服务器
范例用户前端请求带有headers app_key
注意:
默认header不允许_变量名,如果需要
在http段或者server段加underscores_in_headers on;
发送后端方式为在server段或者location段定义,前面有http_
proxy_set_header app_key ${http_app_key};
详细:
http { underscores_in_headers on; server { location / { proxy_pass http://bank/; proxy_set_header app_key ${http_app_key}; } } }
评论区