为什么Cookie请求标头被剪切

时间:2019-06-25 09:31:13

标签: php laravel http cookies artisan

我有一个本地laravel 5.7安装,我从php artisan开始使用php 7.1在Win7上进行服务。我使用默认的用户会话授权,但是它不起作用,因为请求标头的cookie部分已被剪切,因此无法识别会话cookie。

我检查了客户端发送的请求标头和服务器检索的标头。有时会收到完整的Cookie标头,有时只收到一部分。每次重新加载页面时,结果是否都正确地相符,但是在所有页面上都会发生错误。 如果我收到完整的cookie标头,则收到大约2300-2350时,大约有2600个字符。 我使用Laravel Telescope和纯PHP getallheaders函数观看了检索到的标头。结果是相同的。

由客户端发送并由服务器检索的标头的一个示例: 发送

GET /test HTTP/1.1
Host: 127.0.0.1:8000
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
X-FirePHP: 0.4.4
X-FirePHP-Version: 0.4.4
X-Wf-Max-Combined-Size: 262144
Accept-Encoding: gzip, deflate, br
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: refreshToken=eyJpdiI6IlU4cU5hYkNFZFNLT3ZaMHJ6XC8zODVnPT0iLCJ2YWx1ZSI6Ik1ndjhhU1pQUXMwMEQ3Wm8wdXdib2pDRG9cL1k2RGlRa01hY0hOemtSNXR5UkwxbDhCWkhEU0orS2duZVFJemVGNUJWb0xIRXZFWDcxRlwvcFphU3ArS3JBU21zQU0xT1hONWZVZTB5MFczZHY3MFpCSlVjS1ZsY2dzZDJuaHBIbEFkd2VCM29BcHlQZkQ3RzRiaDhpMFpBRDFRRk9VY0dvQ3hsZGxOXC9DSXFcL1JDeE5rU0pmajNBb0FjMDhOVkVKWW9aUDdSM2ttaUpmbW56QmpmMHdFaG1LU1JyeU96Tn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cEl3czdWOHNEIiwibWFjIjoiMjM4ODY4MWIwNTExOWJjNTY4ZmRlOGRjODI0MzhjM2Y1ZDdhMzRlODcyMzMwMGEzYzA0OWEyNzM0ZjNkZjMwYSJ9

已检索(如Laravel Telescope所示):

{
host: "127.0.0.1:8000",
connection: "keep-alive",
pragma: "no-cache",
cache-control: "no-cache",
upgrade-insecure-requests: "1",
user-agent: "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36",
accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
x-firephp: "0.4.4",
x-firephp-version: "0.4.4",
x-wf-max-combined-size: "262144",
accept-encoding: "gzip, deflate, br",
accept-language: "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",
cookie: "refreshToken=eyJpdiI6IlU4cU5hYkNFZFNLT3ZaMHJ6XC8zODVnPT0iLCJ2YWx1ZSI6Ik1ndjhhU1pQUXMwMEQ3Wm8wdXdib2pDRG9cL1k2RGlRa01hY0hOemtSNXR5UkwxbDhCWkhEU0orS2duZVFJemVGNUJWb0xIRXZFWDcxRlwvcFphU3ArS3JBU21zQU0xT1hONWZVZTB5MFczZHY3MFpCSlVjS1ZsY2dzZDJuaHBIbEFkd2VCM29BcHlQZkQ3RzRiaDhpMFpBRDFRRk9VY0dvQ3hsZGxOXC9DSXFcL1JDeE5rU0pmajNBb0FjMDhOVkVKWW9aUDdSM2ttaUpmbW56QmpmMHdFaG1LU1JyeU96TnNHRW9DZTkwcEJ3VzM1eklhUGwweXVWYXFSaFVyUkxYeDZqTmViaVwvdlpDRlF4WDQrbndlRnY2WHJPc1h2RVZnSGx6ak5tK0R4VGt2Qjd5eUlpZ1dYcDA1Q0NTXC9TOHhsSnQxTXUybStNWUY5YXg4UnNRMVdRRTBZTlBKdUt2aGxoazRjaFFcLzlUQm1jVjJzZFNzQjh5Um01clMxT1ZSOWtC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2Uwc2p2VHFrYmIyUml2NmR2ZVQzaTNNSWZiSEt6eFNKQ2o4aDdwYmQ1MU5zWEQzdHRoVzR4MTJ2K0NOb3RJcDhKVzA5Z3JIekx2V2Zwd0RTVUhCbTNXWFBQRnl0ZGNQeEpLNkx0NjlrNElcL1o2NjJvSnc5M2NhY0xlZFwvcWdEcThMdXdXaHVZYXZBM3JUdU1nZ290UURCUmJnNlp0K1RRbE1VYjVyUUl1YVZQNHFyMXhvXC9YaUswRFNHZzE0TW56SURSNjFNc0QwaTlFRXJNQlNBZnlQSkxyd2FJaU8xSTlRUGFmIiwibWFjIjoiOWI4YzZiNjBlMzQ0ZjlkZGVlZWM2NTBmNjYwMTIwYzBmOTAzYjVhZDQ2ZDk5MmUxNWRkZGM4YmI4MzdjNGY2ZSJ9; XSRF-TOKEN=eyJpdiI6IldcL21zcXI1c3lKclQ4WVwvYlRxVWV2dz09IiwidmFsdWUiOiJhTHE5UGN5c2o1RmZVcVdkdW5hR3dnUTlaXC9JOXEzTjkwNGY0VFQwYXRSY0ZHd3pkV3VqTXlyUVpyZmwzMXNpdyIsIm1hYyI6ImM2YTAxNmZhZDUxYWUzNjRmNDY2OWRmMThkMTljYmRiNjZlZDMwMDVhNTczZjZhNjlmOTUxZGI5NWZlN2JjZGYifQ%3D%3D; laravel_myapp_xxx_sessi"
}

如您所见,在这种情况下,cookie标头被切断,因此会话cookie将不会被识别。有时它甚至更短,但是如上所述,有时一切正常。

有人知道为什么会这样吗?

0 个答案:

没有答案