T
T
ttywizard2018-11-22 15:29:12
JavaScript
ttywizard, 2018-11-22 15:29:12

Is it possible to change the HTTP referer?

Hello, the essence of the question is, is it possible to change the HTTP referer to load another URL via iframe?
There is a link to the player, but this player can only be displayed on a specific site, for example foo.com, that is, as I understand it, there is a check just by referer, if the referer is allowed, then the player is displayed, otherwise not. Can I change the referer when loading an iframe on my site? If yes, how to do it? Already googled all over, nothing specific. Tried like this:

Object.defineProperty(document, "referrer", {get : function(){ return "НОВЫЙ REFERE"; }});

after that document.referrer does indeed show the referer I set, however when loading an iframe with src https://www.whatismyreferer.com/ it still gives me the address of my page.
Is it even possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Arkh, 2018-11-22
@ttywizard

I don’t know how to change it on the client, but you can make a proxy on nginx, replace the referrer there and frame this proxy.

location /test/ {
    proxy_pass https://www.whatismyreferer.com/;
    proxy_set_header Referer "https://yandex.ru";
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question