iptables port forward + nginx redirect problem
- by easthero
Here is my network
browser = proxy(iptables port forward) = nginx server
proxy: 192.168.10.204, forward 192.168.10.204:22080 to 192.168.10.10:80
nginx server: 192.168.10.10
nginx version:0.7.65 debian testing
in nginx settings, I set:
server_name _;
server_name_in_redirect off;
because my server has no domain
now, access 192.168.10.10/index.html or 192.168.10.10/foobar is ok
then access 192.168.10.204:22080/index.html is ok
but access 192.168.10.204:22080/foobar, nginx 301 redirect to http://192.168.10.204/foobar
how to fix?
thanks
telnet 192.168.10.204 22080
Trying 192.168.10.204...
Connected to 192.168.10.204.
Escape character is '^]'.
GET /index.html HTTP/1.1
Host: 192.168.10.10
HTTP/1.1 200 OK
Server: nginx/0.7.65
Date: Fri, 28 May 2010 10:07:29 GMT
Content-Type: text/html
Content-Length: 12
Last-Modified: Fri, 28 May 2010 07:25:12 GMT
Connection: keep-alive
Accept-Ranges: bytes
hello world
telnet 192.168.10.204 22080
Trying 192.168.10.204...
Connected to 192.168.10.204.
Escape character is '^]'.
GET /test2 HTTP/1.1
Host: 192.168.10.10
HTTP/1.1 301 Moved Permanently
Server: nginx/0.7.65
Date: Fri, 28 May 2010 10:04:20 GMT
Content-Type: text/html
Content-Length: 185
Location: http://192.168.10.10/test2/
Connection: keep-alive
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/0.7.65</center>
</body>
</html>