Welcome! Log In Create A New Profile

Advanced

proxy_hide_header hiding header from ALL locations

W. Andrew Loe III
July 28, 2010 05:38PM
I have a two phase setup commonly implemented with S3.

I want to set ETag and Last-Modified in my Rails application and have
them take precedence over the S3 ETag and Last-Modified.

location ^~ /AWSS3/ {
# Prevent Client headers from going to nginx.
proxy_pass_request_headers off;

# Prevent nginx from overwriting our headers.
proxy_hide_header "Content-Type";
proxy_hide_header "Last-Modified";
proxy_hide_header "ETag";
proxy_hide_header "Content-Disposition";

# Hide Amazon Headers
proxy_hide_header X-Amz-Id-2;
proxy_hide_header X-Amz-Request-Id;

# Have Amazon do the work buffering the request.
proxy_set_header Host 's3.amazonaws.com'; # the bucket is specified in the url

# Force Amazon to do the heavy lifting.
proxy_buffering off;

# Retry if Amazon freaks out
proxy_next_upstream error timeout http_500 http_502 http_503 http_504;

# Ensure the requests are always gets.
proxy_method GET;
proxy_pass_request_body off;
proxy_set_header Content-Length "";

# Proxy to S3.
proxy_pass http://s3/;
proxy_hide_header ETag;
proxy_hide_header Last-Modified;

internal;
}

What I see on my client is a valid Content-Type and
Content-Disposition set by my Rails application but ETag and
Last-Modified are not set. If I remove those proxy_hide_header
directives the Headers are present but they are the values S3 returns
not the values I returned from Rails.

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

proxy_hide_header hiding header from ALL locations

W. Andrew Loe III July 28, 2010 05:38PM

Re: proxy_hide_header hiding header from ALL locations

W. Andrew Loe III July 28, 2010 05:52PM

Re: proxy_hide_header hiding header from ALL locations

Maxim Dounin July 30, 2010 04:00PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 320
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready