具有集成安全性的跨域 POST
我运行站点 A,并且希望能够将数据发布到托管在不同子域上的站点 B。现在我可以完全访问A,但根本无法修改B。
我的要求是:
- 支持文件上传
- 在 POST 上不刷新浏览器
- 使用 Windows 集成安全性
- 在 IE 7/8 中工作(不需要支持任何其他浏览器)
实现此目的的最佳方法是什么?
我尝试过的方法:
理想情况下,这可以通过简单的 AJAX 调用来完成。然而,当前标准不支持发送二进制数据(XMLHttpRequest Level 2 标准支持,但 IE 中尚未实现)。
因此,下一个最好的办法是 POST 到隐藏的 元素。现在我已经尝试过,但站点 B 上的服务器不接受数据。我查看了该请求,发现唯一的差异是引用 URL 和集成身份验证。引用 URL 可能必须被欺骗,这是此方法无法完成的。此外,由于某种原因,未协商身份验证。我不是 100% 确定为什么。
想法:
我正在考虑在我运行的服务器(站点 A)上创建一个代理页面,将请求转发到站点 B。站点 A 也使用集成安全性。我不认为这有什么问题,但我不确定这是否是最好的方法。如果我直接转发请求会不会出现身份验证问题?
I run a site A and I want to be able to POST data to site B, which is hosted on a different subdomain. Now I have complete access to A, but cannot modify B at all.
My requirements are:
- supports file upload
- does not refresh browser on POST
- uses Windows integrated security
- works in IE 7/8 (does not need to support any other browsers)
What's the best way to accomplish this?
What I've tried:
Ideally this could be done in a simple AJAX call. However the current standard does not support sending binary data (supported in the XMLHttpRequest Level 2 standard, which is not implemented in IE yet).
So the next best thing is to POST to a hidden <iframe>
element. Now I've tried this but the server on site B won't accept the data. I looked at the request and the only discrepancies that I found were the referer URL and the integrated authentication. The referer URL might have to be spoofed, which cannot be accomplished by this method. Also for some reason the authentication isn't being negotiated. I'm not 100% sure why.
Ideas:
I'm thinking of creating a proxy page on the server that I run (site A) that forwards the request to site B. Site A also uses integrated security. I don't see anything wrong with this, but I'm not sure if this is the best way to go. Will there be any authentication issues if I just forward the request over?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用代理似乎是唯一适合您的情况的方法。如果您想发出 get 请求,则可以使用 JSONP 来完成,前提是服务器支持 JSONP。为了使
hack起作用,服务器应该发送标头,但
您的情况并非如此。
所以使用代理似乎是解决方案
Using a proxy seems to be the only thing which can work in your case. If you want to make a get request then it can be done using
JSONP
provided that the server supportsJSONP
. To make the<iframe>
hack work the server should send the headers aswhich is not the case with you.
So using a proxy seems the solution