13

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

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Maca
  • 1,659
  • 3
  • 18
  • 42

3 Answers3

37

Simply adding below solved my issue.

add_header 'Referrer-Policy' 'origin';
Maca
  • 1,659
  • 3
  • 18
  • 42
6

You actually dont need quotes on Refferer-Policy if you add the line into default.conf.

add_header Referrer-Policy 'origin'

Here you can also see other values https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy

Jergus Frajt
  • 61
  • 1
  • 1
0
    location / {
        add_header 'Referrer-Policy' 'unsafe-url';
    }
Zhou
  • 69
  • 2
  • 2
    Could you name the (dis-)advantageous of your solutions compared to the existing answers, please? Any additional explanation could be valuable, I guess. – matheburg Jan 09 '23 at 11:12