Redirecting request fails with 503 Service Unavailable in NGINX

Viewed 10

I'm trying to redirect the requests between lower and Prod environments, which gives 503 service unavailable error.

It seems the requests is still going to lower environment I've another location block for /api/ which drives the request to lower APIGW where the actual uderlying service doesn't exist.

Having NGINX as proxy server which redirects requests to Microservices hosted on Rancher platform through API Gateway.

PFB location block I've added to redirect the request URI which comes in to NGINX, to Prod APIGW.

location = /testdetail {
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      proxy_set_header Content-Length "";
      proxy_set_header Host $host;
      proxy_set_header X-Original-URI-NGINX $request_uri;
      proxy_set_header X-Forwarded-For-NGINX $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto-NGINX $scheme;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Authorization $http_authorization;
      proxy_pass_header Authorization;
      proxy_pass https://apigateway.xxx.xxx.com/test/***/***/***/***/testdetail;
      proxy_pass_request_body off; # no need to send the POST body
    }

In addition to it, there is another location block for /api/.

location /api/ {
      
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        auth_request /validate;
        auth_request_set $auth_status $upstream_status;
        proxy_set_header AuthStatus $upstream_status;
        **proxy_pass https://apigateway-preview.xxx.xxx.com/;**
        proxy_pass_request_headers      on;
        #proxy_connect_timeout 800;
        proxy_read_timeout 90;
        #proxy_send_timeout 800;
        #proxy_redirect off;
0 Answers
Related