This is my file in the NginX /sites-enabled directory:
upstream tomcat_server {
server 192.168.1.100:8080 fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _____.com www._____.com;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://tomcat_server;
}
}
Right now, the flow goes like this:
- I visit my domain _____.com, and the request is mapped to the IP of my router at port 39080.
- In my router, I port forward the request from port 39080 to 192.168.1.136 (where my nginx server is running, separate machine) at port 80.
- Nginx is listening on port 80 and picks up the request.
What I want it to do is redirect the request to the Tomcat server running on a separate machine, so I put proxy_pass
to the Tomcat server.
What actually happens is that the request hangs, and a blank page is on my screen. The Tomcat log shows a 200 OK response to the request, but it should load the rest of the content, including the page and the images and scripts and whatnot.
"GET /app-portal/ HTTP/1.0" 200
// that's it
[/app-portal/
is what my server side code redirects /
to]
I can confirm it's nginx's problem because the page loaded with all its content when I changed the router port forwarding directly to the tomcat server instead of nginx.
What could be the problem?
--
I don't know if this a major problem or not, but I notice that the successful requests (from when I go directly from router to tomcat server) is using HTTP1.1, while nginx's failed requests use HTTP1.0