Welcome! Log In Create A New Profile

Advanced

Adding Page level custom headers

Posted by doraemon 
Adding Page level custom headers
May 25, 2023 09:00AM
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.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 207
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