简体   繁体   中英

how reliabile is document.referrer, can it be spoofed/ faked?

How reliable is document.referrer in determining the source?

I want a website (A) to only work if the visitor came from a specific other website (B).

I am planning to use document.referrer in website A to check whether website B is the source (check is done server-side).

Is it safe and reliable way? If not, what are my alternatives?

I have looked at this , but the use case is exact opposite of mine.

This plan will not provide any degree of security. document.referrer does not exist "on the server side." It only exists as you're talking about in the browser.

What you get on the server is the HTTP referrer , and that is trivial to spoof.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM