简体   繁体   English

使用Java servlet的重定向响应中的HTTP自定义标头丢失

[英]Lost HTTP custom Header in Redirect response with java servlet

I have problems to create http headers and send as response to another request page. 我在创建http标头并将其作为响应发送到另一个请求页面时遇到问题。 I've that code; 我有那个代码; enter image description here 在此处输入图片说明

In browser inspection i found enter image description here 在浏览器检查中,我发现在此处输入图片描述

but when i go to redirected page, i dont received that header 但是当我转到重定向页面时,我没有收到该标头

enter image description here 在此处输入图片说明

You send a redirect - which won't carry the headers of the original request. 您发送重定向-不会包含原始请求的标头。 See https://httpstatuses.com/303 参见https://httpstatuses.com/303

Make yourself clear what's happening: your response carries the status code 303, which will trigger the client to create a new request to the url you specified. 让自己清楚发生了什么:响应中带有状态码303,它将触发客户端向您指定的网址创建新请求。 And this new request won't contain the prior response's headers. 并且此新请求将不包含先前响应的标头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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