CORS with XMLHttpRequest

半城伤御伤魂 提交于 2019-12-12 01:12:39

问题


I'm trying to make a POST request between two sites.

I've seen the need to change header of request on server side using the access-allow. My problem is that when I send request I can't see this modification in the response header.

If I go on directly on page the headers are change. If I sent request with GET, I can see too that the headers has been changed. Maybe there is server configuration of http which is forbidden across domain POST request?

I'm using a Ngnix server that serves Drupal sites.


回答1:


As far as I know, the header you should change is the response header of the site that receive the request (or site 2). Thus, it allows the client (or site 1) to perform a CORS request, adding the header "Access-Control-Allow-Origin" and the domain of site 1 (or '*') into the response.



来源:https://stackoverflow.com/questions/14728418/cors-with-xmlhttprequest

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!