Home > Backend Development > PHP Tutorial > NGINX study notes - passing request headers

NGINX study notes - passing request headers

WBOY
Release: 2016-07-29 08:56:16
Original
1219 people have browsed it

Original address: https://www.nginx.com/resources/admin-guide/reverse-proxy/
Original title: Passing Request Headers


By default, NGINX will redefine two HTTP header fields, "Host" and "Connection" when proxying a request, and delete the header fields with empty values. "Host" will be set to the value of the $proxy_host variable, and "Connection" will be set to close.
By default, NGINX redefines two header fields in proxied requests, “Host” and “Connection”, and eliminates the header fields whose values ​​are empty strings. “Host” is set to the $proxy_host variable, and “Connection” is set to close .

To change these settings, including modifying other header fields, use the proxy_set_header command. This directive can be used in location or higher. Can also be in a specific server context or in an http block, for example:
To change these setting, as well as modify other header fields, use the proxy_set_header directive. This directive can be specified in a location or higher. It can also be specified in a particular server context or in the http block. For example:

<code>location /some/path<span>/</span> {
    proxy_set_header Host <span>$host</span>;
    proxy_set_header X<span>-Real</span><span>-IP</span><span>$remote_addr</span>;
    proxy_pass http:<span>//localhost:8000;</span>
}</code>
Copy after login

In this configuration, the "Host" field is set to the $host variable.
In this configuration the “Host” field is set to the $host variable. To prevent a header field from being passed to the proxied server, just set it to the empty string.

To prevent a header field from being passed to the proxied server, set it to an empty string as follows:

<code>location /some/path<span>/</span> {
    proxy_set_header Accept<span>-Encoding</span><span>""</span>;
    proxy_pass http:<span>//localhost:8000;</span>
}</code>
Copy after login

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); }); The above introduces the NGINX study notes - passing request headers, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template