Solutions to cross domain problems in spring MVC

preface

Cross domain means that the browser cannot execute scripts from other websites. It is caused by the browser's homology policy and the security restriction imposed by the browser on JavaScript. This article will introduce the cross domain problem solving related content of spring MVC in detail and share it for your reference and study. I won't say much below. Let's take a look at the detailed introduction together.

problem

A restful interface is developed using spring MVC for front-end calls

But the front-end call fails

It should be a cross domain issue

solve

Spring MVC already has a good solution. You can directly add an annotation (@ crossorigin) to solve the cross domain problem

Return header of local request through restlet client when no comment is added

https://spring.io/blog/2015/06/08/cors-support-in-spring-framework

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>