How add custom response header in Apache2

This post explain how you can change response headers for all your websites configuring apache2 in linux.

First you have to enable an apache module called "headers", this step is absolutly necesary.

sudo a2enmod headers

Then you have to restart apache.


systemctl restart apache2

Then you can add your personalized header on file:

/etc/apache2/sites-available/000-default.conf

Remember this file could be diferent depending your server, it could be: "000-mysite.conf"

You have to set your personal header between this lines like the next picture.


Finaly save file and restart apache. 


systemctl restart apache2

And check your headers response using curl.


curl -i http://localhost






Comments