[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nginx
Subject:    post_action, rewrites, and proxy_pass
From:       Michael Payne <michael.payne () aquicore ! com>
Date:       2017-08-09 17:21:31
Message-ID: CAO9ke+pgbfEE3NnPcYgN-Q0=FronuBS6Spjckt9QoJ1or0w0_A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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;
}
}

[Attachment #5 (text/html)]

<div dir="ltr"><span style="font-size:12.8px">v1.4.6</span><div \
style="font-size:12.8px"><br></div><div style="font-size:12.8px">I&#39;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  <a \
href="http://some.domain.com/some_resource" \
target="_blank">some.domain.com/some_resource</a></div><div \
style="font-size:12.8px"><br></div><div style="font-size:12.8px">The final \
post_action hop at the bottom is attempting to pass the request and its params as  <a \
href="http://dev-data.app.com/api/v3/some_resource" \
target="_blank">http://dev-data.app.com/api/<wbr>v3/some_resource</a></div><div \
style="font-size:12.8px"><br></div><div style="font-size:12.8px">I&#39;ve confirmed \
my rewrite logic, though no domain shows up in the log.   Same with the additional \
access_log.   I&#39;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  <a \
href="http://dev-data.app.com/api/v3/some_resource" \
target="_blank">http://dev-data.app.com/api/<wbr>v3/some_resource</a>  API.</div><div \
style="font-size:12.8px"><br></div><div style="font-size:12.8px">But mainly \
interested in my use of the syntax and the expectation.   Any tips as to what I am \
doing wrong?</div><div style="font-size:12.8px"><br></div><div \
style="font-size:12.8px"><div>server {</div><div>      listen 80 \
default_server;</div><div>      server_name  <a href="http://some.domain.com/" \
target="_blank">some.domain.com</a>;</div><div><br></div><div>      \
#...</div><div><br></div><div><span style="white-space:pre-wrap">	</span>location / \
{</div><div><span style="white-space:pre-wrap">		</span>proxy_ignore_client_abort \
on;</div><div><span style="white-space:pre-wrap">		</span>proxy_pass  <a \
href="http://app-prod.herokuapp.com/" \
target="_blank">http://app-prod.herokuapp.com</a>;</div><div><span \
style="white-space:pre-wrap">		</span>proxy_set_header X-Real-IP   \
$remote_addr;</div><div><span style="white-space:pre-wrap">		</span>proxy_set_header \
X-Forwarded-For $remote_addr;</div><div><span \
style="white-space:pre-wrap">		</span>proxy_set_header Host  <a \
href="http://aq-prod.herokuapp.com/" \
target="_blank">aq-prod.herokuapp.com</a>;</div><div><span \
style="white-space:pre-wrap">		</span>post_action @stage;</div><div><span \
style="white-space:pre-wrap">	</span>}</div><div><br></div><div><span \
style="white-space:pre-wrap">	</span>location @stage {</div><div><span \
style="white-space:pre-wrap">		</span>proxy_pass  <a href="http://stage.myapp.com/" \
target="_blank">http://stage.myapp.com</a>;</div><div><span \
style="white-space:pre-wrap">		</span>post_action @app_log;</div><div><span \
style="white-space:pre-wrap">	</span>}</div><div><br></div><div><span \
style="white-space:pre-wrap">	</span>location @app_log {</div><div><span \
style="white-space:pre-wrap">		</span>proxy_pass  <a \
href="http://app-log.herokuapp.com/" \
target="_blank">http://app-log.herokuapp.com</a>;</div><div><span \
style="white-space:pre-wrap">		</span>post_action @dev;</div><div><span \
style="white-space:pre-wrap">	</span>}</div><div><br></div><div><span \
style="white-space:pre-wrap">	</span>location @dev {</div><div><span \
style="white-space:pre-wrap">		</span>#rewrite_log on;</div><div><span \
style="white-space:pre-wrap">		</span>rewrite ^ /api/v3$request_uri$1 \
break;</div><div><span style="white-space:pre-wrap">		</span>proxy_pass  <a \
href="http://dev-data.app.com/" \
target="_blank">http://dev-data.app.com</a>;</div><div><span \
style="white-space:pre-wrap">		</span>#access_log \
/var/log/nginx/proxy-access.<wbr>log;</div><div><span \
style="white-space:pre-wrap">	</span>}</div><div>}</div></div></div>



_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic