Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

GET requests returning 404 (no replies)

$
0
0
Hi,

We are using Play for the backend and using NGinx to serve requests for static files from local.

Below is the config that we are using

upstream backend {
server x.x.x.x:9000;
}

server {
listen 0.0.0.0:8082;
server_name localhost;

location /client {
root /static;
expires off;
sendfile off;
}

location / {
proxy_set_header Access-Control-Allow-Origin *;
proxy_set_header 'Access-Control-Allow-Credentials' 'true';
proxy_set_header 'Access-Control-Allow-Headers' 'X-Requested-With,Accept,Content-Type, Origin';
proxy_set_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE, HEAD';

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;

proxy_pass http://backend;
proxy_redirect off;
}

}

Some requests like "GET /api/alerts" returns 404

Now here is the wierd part. When I update the configuration like below, basically copying the same config for this specific uri path, I get 200 OK back

upstream backend {
server x.x.x.x:9000;
}

server {
listen 0.0.0.0:8082;
server_name localhost;

location /client {
root /static;
expires off;
sendfile off;
}

location /api {
proxy_set_header Access-Control-Allow-Origin *;
proxy_set_header 'Access-Control-Allow-Credentials' 'true';
proxy_set_header 'Access-Control-Allow-Headers' 'X-Requested-With,Accept,Content-Type, Origin';
proxy_set_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE, HEAD';

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;

proxy_pass http://backend;
proxy_redirect off;
}

location / {
proxy_set_header Access-Control-Allow-Origin *;
proxy_set_header 'Access-Control-Allow-Credentials' 'true';
proxy_set_header 'Access-Control-Allow-Headers' 'X-Requested-With,Accept,Content-Type, Origin';
proxy_set_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE, HEAD';

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;

proxy_pass http://backend;
proxy_redirect off;
}

}

what could be the issue?

Viewing all articles
Browse latest Browse all 7229

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>