proxy_pass in post_action location does not send any http request

clintmiller nginx-forum at
Fri Jan 10 21:29:11 UTC 2020

Hi, jacks.

I use post_action for something similar to this for keeping track of users
who download files. I've got a location for the /download entry point like

  location ~ /download/ {
    proxy_pass http://app_pool;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    post_action @finished;

  # for mod_zip and x-accel-redirect requests, proxying the
  # request to S3 to fulfill the zip manifest or the x-accel-redirect URI
  location ~

    resolver valid=30s; # Google DNS
    resolver_timeout 10s;

    proxy_http_version 1.1;
    proxy_set_header Host $s3_bucket;
    proxy_set_header Authorization '';

    # remove amazon headers
    proxy_hide_header x-amz-id-2;
    proxy_hide_header x-amz-request-id;
    proxy_hide_header Set-Cookie;
    proxy_ignore_headers "Set-Cookie";

    # bubble errors up
    proxy_intercept_errors on;

    proxy_pass https://$s3_bucket/$path?$args;

  location @finished {

    rewrite ^

  location ^~ /download/finish {
    proxy_pass http://$download_postback_hostname; # variable map declared

This does work for sending the post_action response after the /download
request is served- with one notable caveat! It does not work for
X-Accel-Redirect responses from my app server. As far as I can tell, the
post_action is either (1) never called in that case, or (2) has some other
issue I have been able to figure out. I've dug around in the C source for
Nginx, but it gets to a spot pretty quick where I'm in over my head.

Although I've been living with this since 2017, here's my mailing list post
regarding the issue from 2018:,278529

I've considered trying to engage Nginx for commercial support on this one
issue, but I'm not sure what kind of appetite they may have for these types
of issues.

Posted at Nginx Forum:,286384,286703#msg-286703

More information about the nginx mailing list