I'm trying to use nginx as a reverse proxy for two Tomcat Instances, each in their own VM. The problem is: when i start to add a folder-path to the proxy_pass argument, i get a 310 error: Too many redirects.
What am i doing wrong? Any advice is appreciated. The first server just works fine, but as mentioned before, the second, with the added folderpath wont work.
Here is my nginx config:
server {
listen 80;
server_name oc.domain.tld;
location / {
proxy_pass http://172.16.81.73;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name test.domain.tld;
location / {
proxy_pass http://172.16.75.99/OpenClinica/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80 default_server;
server_name _;
return 444;
}
edit: there is no SSL enabled at the moment (both tomcat & nginx)
edit2: my rewrite log is empty (if i switch it on, debugging on notice level)
I just discovered this lines in my nginx log(the GET .../login/login line is repeated for about 20 times:
190.215.166.212 - - [04/May/2013:22:29:21 -0400] "GET /OpenClinica/pages/login/login HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"
190.215.166.212 - - [04/May/2013:22:29:21 -0400] "GET /OpenClinica/pages/login/login HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31"
190.215.166.212 - - [04/May/2013:22:29:25 -0400] "-" 400 0 "-" "-"
190.215.166.212 - - [04/May/2013:22:29:25 -0400] "-" 400 0 "-" "-"
It seems, that nginx requests ....login/login in a loop. So the problem is perhaps on the tomcat side?