February 11, 2015 05:53PM
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?
Subject Author Posted

GET requests returning 404

sdenthumdas February 11, 2015 05:53PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready