Just started using my very first nginx server and I have added few header, but I was wondering, is it possible somehow to import those headers from different file?

Let,s say, I have a _headers file with such content:

add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Referrer-Policy "SAME-ORIGIN";
add_header Feature-Policy "geolocation 'none'; microphone 'none';";

And can I somehow import it into my /etc/nginx/sites-available/example.com?


Well, this looks like this is a possible thing! I used "include" directive for that and it worked pretty good!

Found it here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.