Welcome! Log In Create A New Profile

Advanced

Setting response headers per file

Arnold Hendriks
January 06, 2023 12:34PM
Is there a way to have nginx serve up static content with custom headers -
but being able to set these headers per file (and not in the nginx
configuration)

Eg. if I request http://127.0.0.1/attachment-12345 I would like nginx to
use try_files to find the file 'attachment-12345' and serve it... but to
also look at 'attachment-12345.headers', take
Content-Type: application/mswordContent-Disposition: attachment;
name="abc.doc"Cache-Control: immutable
from that file and serve those headers. So nothing based on extension, and
each file can have its own headers.
(This would allow me to somewhat simulate a S3/Cloudfront based cache using
local disk... as S3 allows me to set a subset of HTTP headers for every
file)
It would be even cooler if you could also put X-Accel-Redirect or Status:
301 headers in such a file and manage those in a 'static' way, but that's
beyond what I need now
With regards,Arnold Hendriks
_______________________________________________
nginx mailing list
nginx@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Setting response headers per file

Arnold Hendriks January 06, 2023 12:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 148
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready