post_action, rewrites, and proxy_pass
Michael Payne
michael.payne at aquicore.com
Wed Aug 9 17:21:31 UTC 2017
v1.4.6
I'm attempting to proxy pass requests to AWS API Gateway, but they are not
reaching the endpoint. Example of my configuration below. Requests come
through as something like some.domain.com/some_resource
The final post_action hop at the bottom is attempting to pass the request
and its params as http://dev-data.app.com/api/v3/some_resource
I've confirmed my rewrite logic, though no domain shows up in the log.
Same with the additional access_log. I'd love more debug information as to
what the final transformation is and the response it gets back. There are
NO error or info logs on my http://dev-data.app.com/api/v3/some_resource
API.
But mainly interested in my use of the syntax and the expectation. Any
tips as to what I am doing wrong?
server {
listen 80 default_server;
server_name some.domain.com;
#...
location / {
proxy_ignore_client_abort on;
proxy_pass http://app-prod.herokuapp.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host aq-prod.herokuapp.com;
post_action @stage;
}
location @stage {
proxy_pass http://stage.myapp.com;
post_action @app_log;
}
location @app_log {
proxy_pass http://app-log.herokuapp.com;
post_action @dev;
}
location @dev {
#rewrite_log on;
rewrite ^ /api/v3$request_uri$1 break;
proxy_pass http://dev-data.app.com;
#access_log /var/log/nginx/proxy-access.log;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170809/c7b885ef/attachment.html>
More information about the nginx
mailing list