X-Accel-Redirect not redirecting to named locaiton

Francis Daly francis at daoine.org
Wed Jul 1 08:05:19 UTC 2020


On Tue, Jun 30, 2020 at 09:19:40PM -0400, latha wrote:

Hi there,

> I have the below config, calling /v2/test/status calls the
> http://test.svc.cluster.local:9080/status.  But the named location `acreate`
> is not being called. http://test.svc.cluster.local:9080/status  does return
> `X-Accel-Redirect: @acreate` in response header.

The below config works for me, as the tests show.

Can you show the results of similar tests, to see where the difference is?

Configuration:

==
  server {
    listen 6060;
    location @named {
      return 200 "In @named location 6060\n";
    }
    location ~ /v2/test(.*)$ {
      set $serv http://127.0.0.1:9080$1;
      proxy_pass $serv;
    }
  }
  server {
    listen 9080;
    return 200 "In 9080, request was $request_uri\n";
    add_header X-Accel-Redirect @named;
  }
==
Test request/response pairs:

==
$ curl -i http://127.0.0.1:9080/direct
HTTP/1.1 200 OK
Server: nginx/1.17.2
[snip]
X-Accel-Redirect: @named

In 9080, request was /direct

$ curl -i http://127.0.0.1:6060/v2/test/status
HTTP/1.1 200 OK
Server: nginx/1.17.2
[snip]

In @named location 6060
==

You indicate that you don't get the response that you want.

What response do you get?

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list