How to set Referrer Policy with nginx

Maca picture Maca · Apr 17, 2017 · Viewed 25.5k times · Source

My CMS(https) and image server(http) is separate. I have setup my image server so that it only can serve to whitelisted referrer pages. Now my issue is how do I allow the CMS server to send response header to the image server so the CMS can display the images? I have found giving this html meta tag in the html will display the images.

<meta name="referrer" content="origin">

but is it possible to do this without editing each html page and do this server side? I am on Nginx v1.10.2

Answer

Maca picture Maca · Apr 17, 2017

Simply adding below solved my issue.

add_header 'Referrer-Policy' 'origin';