Cookies 即使请求是来自另一台服务器的代理,也可以在我自己的域上设置cookie吗?

Cookies 即使请求是来自另一台服务器的代理,也可以在我自己的域上设置cookie吗?,cookies,dns,reverse-proxy,Cookies,Dns,Reverse Proxy,下面是一些场景: 1) 正常情况 Request: Client Browser ->(HTTP Request) -> MyServer.com Response: MyServer.com -> (HTTP Response with Cookie on MyServer.com) -> clientBrowser Request: Client Browser ->(HTTP Request) -> ProxyServer.com -> (Ht

下面是一些场景:

1) 正常情况

Request:
Client Browser ->(HTTP Request) -> MyServer.com 
Response:
MyServer.com -> (HTTP Response with Cookie on MyServer.com) -> clientBrowser
Request:
Client Browser ->(HTTP Request) -> ProxyServer.com -> (Http Request) -> MyServer.com 
Response:
MyServer.com -> (HTTP Response with Cookie on MyServer.com) -> ProxyServer.com -> (Http Response with ???) -> clientBrowser
  • Cookie设置在MyServer.com域中
2) 代理情况

Request:
Client Browser ->(HTTP Request) -> MyServer.com 
Response:
MyServer.com -> (HTTP Response with Cookie on MyServer.com) -> clientBrowser
Request:
Client Browser ->(HTTP Request) -> ProxyServer.com -> (Http Request) -> MyServer.com 
Response:
MyServer.com -> (HTTP Response with Cookie on MyServer.com) -> ProxyServer.com -> (Http Response with ???) -> clientBrowser
问题是:

a) ProxyServer将在Http响应中看到我的cookie,对吗?(在http响应头中)


b) ProxyServer.com能否在Myserver.com域中设置cookie(来自Myserver.com)?

您可以在创建cookie时自己明确设置cookie的域

这是如何在php中实现的

bool setcookie ( string $name [, string $value [, int $expire = 0 [, string $path [, string $domain [, bool $secure = false [, bool $httponly = false ]]]]]] )
谷歌搜索其他脚本语言


这就是你想要的吗???

我认为你不能将cookie设置在你的域之外。我刚刚测试过。我只是想知道,如果有代理之间(不同的领域),它仍然是真实的吗?它应该。。不应该是个问题