Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Adding Page level custom headers

$
0
0
Hello,

I want to add custom headers for each individual html file served by Nginx locally.

I know that adding headers for folder level is done with config files, but I want to have different header for each html files served by Nginx.

I read about automatic pushing available if proxy server sends preload link headers, ref: https://www.nginx.com/blog/nginx-1-13-9-http2-server-push/

My reverse proxy setting is like this :

try_files $uri $uri/index.html @proxy

But I dont want this feature for proxy responses, only for local html files.

I want to have a separate header file for every html files either in the same folder or in a separate folder.

For example /my-site.com/index.html & /my-site.com/index.headers.html (or /my-site.com/index.html.headers)

Or /my-site.com/index.html. & /my-site.com/headers/index.html (or headers file may not have .html extension)

Is this possible with a simple configuration? Lets say I have 1 million pages where using default config file to load different header for each individual html file is not logical.

Viewing all articles
Browse latest Browse all 4759

Trending Articles