apache2代理跨源申请cookie
我在子域/internal
中的文件夹上设置了一个代理设置,并且我正在尝试从请求中获取我的node.js应用程序上的cookie标题起源但具有相同的域。
这是我的虚拟主机中api.example.com
的代理:
ProxyRequests on
ProxyPreserveHost on
ProxyPass /internal http://localhost:8760
ProxyPassReverse /internal http://localhost:8760
当我从api.example.com to
api.example.com发出AJAX请求时/internal/ajax
当我在node.js应用程序上登录它时,cookie头将存在。
AJAX请求:
$.ajax({
type: "GET",
url: "https://api.example.com/internal/ajax",
dataType: "json",
cache: false
});
问题是当我提出完全相同的ajax请求时,但从sample.example.com
to api.example.com/internal/ajax 就像cookie头被删除,但其他每个标头仍然存在
I have a Proxy set on a folder in my subdomain /internal
and I am attempting to get the cookies header on my Node.JS App from the request but it is unset when the request is made from a different origin but with the same domain.
Here is the proxy in my virtual host for api.example.com
:
ProxyRequests on
ProxyPreserveHost on
ProxyPass /internal http://localhost:8760
ProxyPassReverse /internal http://localhost:8760
When I make an AJAX request from api.example.com
to api.example.com/internal/ajax
the cookie header is present when I console log it on my Node.JS App.
AJAX Request:
$.ajax({
type: "GET",
url: "https://api.example.com/internal/ajax",
dataType: "json",
cache: false
});
The problem is when I make the exact same AJAX request but from sample.example.com
to api.example.com/internal/ajax
it's like the cookie header gets deleted but every other header is still present
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论