Angular 6 + Spring Boot: Error: “from origin 'http://localhost:4200' has been blocked by CORS policy”

前端 未结 4 1914
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-19 16:59

I am trying to connect angular 6 project with spring boot application. When I run angular project, it constantly gives this error, although I have installed all the dependen

4条回答
  •  被撕碎了的回忆
    2021-01-19 17:24

    Issue is with the ordering of filters with spring boot. Add this annotation on your CORSFilter: @Order(Ordered.HIGHEST_PRECEDENCE).

    This will make sure that your CORSFilter has highest precendence of execution (most prior).

提交回复
热议问题