apache2代理跨源申请cookie

发布于 2025-02-07 18:06:48 字数 744 浏览 1 评论 0原文

我在子域/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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文