Apache and Nginx as reverse proxy: where to add X-Robots-Tag?

1.1k Views Asked by At

If Nginx works as reverse proxy between Apache and the web, where should i add X-Robots-Tag (to add some additional headers) - in the htaccess of Apache or in the Nginx configuration file?

1

There are 1 best solutions below

3
On

You can do it in either place. Although, for a header like X-Robots-Tag, which is very much page specific then it would probably be easier to set this at the application server (in your application/CMS). Devs may not have access to the proxy server in order to apply specific headers.

Alternatively, you might choose to do this in the front-end proxy if you wanted to apply this to every request, or to a specific pattern.

But you should not apply the same header in both places, as that becomes hard to maintain (and debug).