No Access-Control-Allow-Origin header is present on the requested resource

前端 未结 4 1300
感情败类
感情败类 2020-12-05 05:08

I want to access information from same domain but with different port number, To allow this I am adding Access-Control-Allow-Origin with the response header.

4条回答
  •  时光说笑
    2020-12-05 05:52

    I find the solution in spring.io,like this:

        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        response.setHeader("Access-Control-Max-Age", "3600");
        response.setHeader("Access-Control-Allow-Headers", "x-requested-with");
    

提交回复
热议问题