I'm getting a 405 response when I try to request to my Tomcat server through an Nginx reverse proxy.
If I request directly to the tomcat server it works successfully from Chrome or Firefox. But if I request to Nginx Proxy I get a 405 from Chrome, but works from Firefox.
I've been testing with different configuration in my nginx.conf under location/foo/ { ... }
I've tried:
error_page 405 =200 $uri;
Also
add_header "Allow" "GET, POST, HEAD, PUT, DELETE" always;
add_header "Access-Control-Allow-Methods" "GET, POST, PUT, DELETE, OPTIONS" always;`
location / {
dav_methods PUT DELETE;
proxy_pass http://csprocure;
}
My nginx.conf for redirections is as follows:
upstream serverS {
server xxx.xxx.xxx.xxx:yyyy;
}
server {
listen 80;
server_name $hostname;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
error_log /dev/stdout info;
access_log /dev/stdout;
location /foo/ {
proxy_pass http://serverS;
proxy_redirect http://xxx.xxx.xxx.xxx/ http://xxx.xxx.xxx.xxx:yyyy/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto: https;
}
What can I add to my configuration to avoid the 405 in Chrome?