I have an use-case where for a particular request with path say /test-abc, i want the request to go to S3 rather than kong and all requests with path other than /test-abc should flow to kong gateway. I tried adding the location block in nginx-kong.conf as below, But I don’t see requests going to s3. Can someone please help me understand what I’m missing here?
One observation I have is that, when I add a return directive inside /test-abc location the requests are reaching corrects location block(/test-abc) but with proxy_pass it is actually going to location block- (/)
# Kong's Proxy server block
server {
server_name kong;
# any contents until the location / block
...
location / {
...
}
location /test-abc {
proxy_pass <s3-url-here>
add_header 'content-type' 'application/json';
add_header 'cache-control' 'public, max-age=0';
add_header 'vary' 'Accept-Encoding';
add_header 'accept-ranges' 'bytes';
charset UTF-8;
default_type application/json;
}
}