Please help me I have an IIS server and NGN proxy when I am connected to my NGX I sometimes get 400 bad Request (invalid hostname) error and when I press F5 and load the correct (200 codes) to load my site, but without script / CSS ... and when I press F5 angain 400 error
On IIS
I tried with two nginx configurations:
ago
Location / {proxy_pass http: // local host: 81; Host $ proxy_set_header host; Proxy_set_header X-real-IP $ remote_adder; Proxy_set_header for X-Forward-$ remote_addr; Port_in_redirect closed; Proxy_connect_timeout 300; }
second
location / {proxy_pass http: // localhost: 81; Host $ proxy_set_header host; Proxy_set_header X-axle- 0 expires; Proxy_set_header X-real-IP $ remote_adder; Proxy_set_header X-Forward- $ proxy_add_x_forwarded_for; }
Both of these first and second configs have this error. Version 1.6.2 NGX
Nginx error.log is empty Nginx Access Log This way
217.66.152.89 - - [16 / March 2015: 23: 42: 56 +0300] "Received / HTTP / 1.1 "400 334" - "" Mozilla / 5.0 (Windows NT 6.3; WOW64) Apple WebKat / 537.36 (KHML, like GECO) Chrome / 41.0.2272.89 Safari / 537.36 "217.66.152.89 - - [16 / March / 2015: 23: 42: 58 +0300] "GET / HTTP / 1.1" 200 68 9 "-" "Mozilla / 5.0 (Windows NT 6.3; WOW64) Apple WebKit / 537.36 (KHML, like GECO) Chrome / 41.0.2272.89 Safari / 537.36 "217.66.152.89 - - [16 / March / 2015: 23: 43: 01 +0300]" GET / HTTP / 1.1 "400 334" - "" Mozilla / 5.0 (Windows NT 6.3; 64) Apple WebKat / 537.36 (KAHTML, like GECO) Chrome / 41.0.2272.8 9 Safari / 537.36 "217.66 152.8 9 - - [16 / March 2015: 23: 43: 03 +0300]" GET / HTTP / 1.1 "200 689 "-" Mozilla / 5.0 (Windows NT 6.3; WOW64) Apple WebKat / 537.36 (KHtml, like Geeko) Chrome / 41.0.2272.8 9 Safari / 537.36 "
In the iis log only 200 and 304 codes are
request header
Accept: text /html,application/xhtml+xml,application/xml;q=0.9,image/webp, * / *; Q = 0.8 Accept-encoding: gzip, deflate, s DC acceptable language: ru-ru, ru; Q = 0.8, N-US; Q = 0.6, N; Q = 0.4 cache-control: maximum-age = 0 connection: keep-alive cookie: mode = undefined; View = Undefined Host: (This is my host) If-Modified-Since: Mon, 16 March 2015 12:56:48 GMT-None-Match: "4e905caae85fd01: 0" User-agent: Mozilla / 5.0 (Windows NT) 6.3; WOW64) Apple WebKat / 537.36 (KHtml, like GEOCO) Chrome / 41.0.2272.8 9 Safari / 537.36
I hope for your help.
The only problem was that this was due to the fact that the server DNS name resolved only on one IPv4 address , When "localhost" had both IPv4 and IPv6.
When NGINX tried to solve an upstream, it was getting ":: 1" and was going on IPv6 - but HTTP.SYS (IIS Network Layer for discussion) later IVV4 address is found in the name "host:" header
This situation is not handled correctly, despite the fact that the symbolic name, "localhost", IPv4 address and ":: 1 "IPv6 is actually related to the same machine.
Workaround - Remove the proxy_set_header host $ host
command or use the numeric upstream address in the proxy_pass
URI.
No comments:
Post a Comment