Nginx はカスタムヘッダーを読み取ります
参考情報:
http://stackoverflow.com/questions/8393772/how-to-get-non-standard-http-headers-on-nginx
http://nginx .org/en /docs/http/ngx_http_core_module.html#underscores_in_headers
http://serverfault.com/questions/297225/nginx-passing-back-custom-header
https://easyengine.io/tutorials/nginx/forwarding -visitors-real -ip/
http://www.ttlsa.com/nginx/nginx-proxy_set_header/
以下が取得されます:
1. nginx は非 nginx 標準のユーザー定義ヘッダーの読み取りをサポートしますが、ヘッダーの下線のサポートを有効にする必要があります。 http またはサーバーの下:
underscores_in_headers on;
2 たとえば、ヘッダーを
$http_x_real_ip にカスタマイズすると、先頭に追加の http_ が追加されます。を渡す
例: <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><span>http</span><span>{</span><span>
upstream myServer </span><span>{</span><span> server </span><span>127.0</span><span>.</span><span>0.1</span><span>:</span><span>8082</span><span>;</span><span>}</span><span>
underscores_in_headers on</span><span>;</span><span>
server </span><span>{</span><span>
listen </span><span>80</span><span>;</span><span>
server_name localhost</span><span>;</span><span> location </span><span>/</span><span>{</span><span>
proxy_set_header </span><span>Some</span><span>-</span><span>Thing</span><span> $http_x_custom_header</span><span>;;</span><span>
proxy_set_header X</span><span>-</span><span>Forwarded</span><span>-</span><span>For</span><span> $proxy_add_x_forwarded_for</span><span>;</span><span>
proxy_pass http</span><span>://</span><span>myServer</span><span>;</span><span>}</span><span>}</span><span>}</span></pre><div class="contentsignin">ログイン後にコピー</div></div>