I am encountering a 503 Service Unavailable error when trying to access a GraphQL API through an Nginx reverse proxy setup. The server setup works fine on one server but fails on another with the same configuration. Below is the curl command used to send a POST request to the GraphQL API, which fails on the Leiria server but succeeds on the shared services server.
Curl Command for Leiria server:
curl -X POST -H "Content-Type: application/json" -d '{...}' https://otp.leiria.urbanplatform.city/otp/routers/default/index/graphql
Response:
<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>
Same curl command for shared-services:
curl -X POST -H "Content-Type: application/json" -d '{...}' https://otp.shared-services.ubiwhere.com/otp/routers/default/index/graphql
Response:
{"data":{"plan":{"debugOutput":{"totalTime":6,"pathCalculationTime":3,"precalculationTime":0, ...
Nginx Configuration for Leiria:
server {
listen 80;
server_name otp.leiria.urbanplatform.city;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name otp.leiria.urbanplatform.city;
...
location /otp/routers/default/index/graphql {
proxy_pass https://otp.shared-services.ubiwhere.com/otp/routers/default/index/graphql;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
...
}
}
Details:
- The same API request succeeds when directly hitting https://otp.shared-services.ubiwhere.com/otp/routers/default/index/graphql.
- The nginx server redirects and proxies the request correctly according to configuration.
- SSL certificates and paths are correctly configured.
What could be causing the 503 Service Unavailable error specifically on the Leiria server?
Are there any potential issues in the Nginx configuration that might be causing this error?
Could this be related to network issues or the upstream server configurations?
I would appreciate any insights or suggestions on debugging and resolving this issue.
Gabriel Saudade is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.