你能以任何可靠的方式在 PHP 中设置 HTTP_REFERER 吗?
背景:我需要为第三方商店设置HTTP_REFERER
,以识别他们商店的用户来自我的页面。
问题:用户身份验证通过 HTTPS 进行保护。将用户从 HTTPS 发送到 HTTP 自定义存储时,网络浏览器的标准安全行为将启动,并且 HTTP_REFERER
会丢失。
来自 HTTPS,有什么方法可以可靠地设置 HTTP_REFERER
值吗?
Background: I need to set HTTP_REFERER
for a 3rd party store to recognize that the user of their store is coming from my page.
Issue: Users authenticate, which is secured over HTTPS. When sending the user from HTTPS to the HTTP custom store, standard security behavior of web browsers kick in and the HTTP_REFERER
is lost.
Coming from HTTPS, is there any way to set the HTTP_REFERER
value reliably?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您使用 CURL 时,您使用它设置的标头仅由 CURL 自己的请求功能使用。它对用户的浏览器完全没有影响。
与
header()
相同。它只会将响应标头设置为来自用户浏览器的当前请求。无法设置用户浏览器在 PHP 的下一个请求中应使用的引用标头。
假设您要使用 CURL 执行整个请求,然后回显请求的结果,它应该可以工作。但除此之外,没有。
When you use CURL, the headers you set using it are only used by CURL's own request functionality. It has absolutely no effect on the user's browser.
The same with
header()
. It will only set response headers to the current request from the user's browser.There is no way to set the referrer header the user's browser should use in the next request from PHP.
Assuming you were to perform the entire request using CURL, and then echoing the results of the request, it should work. But besides that, no.