has been blocked by CORS policy: No ‘Access-Control-Allow-Origin‘ header is present---nginx工作笔记006

   关于跨域的问题,是老生常谈了....这回又出现了...

has been blocked by CORS policy: No ‘Access-Control-Allow-Origin‘ header is present---nginx工作笔记006

 

不过这个跨域问题是可以在nginx中配置解决了:

直接看nginx.conf配置文件把:

下面的:

charset utf-8;
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers Origin,X-Requested-Width,Content-Type,Accept;

这一部分就是用来解决跨域的

    server {
        listen       8001;
        server_name  localhost;

charset utf-8;
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Headers Origin,X-Requested-Width,Content-Type,Accept;

        #charset koi8-r;
        #access_log  logs/host.access.log  main;

 location / {
	 root  D:/ALLSVN/ydy/YdyFront;
        	 index  userLogin.html userLogin.htm;
        }

 location
上一篇:跨域原理及解决方案


下一篇:cors处理 spring boot跨域问题