SpringBoot uploads files across domains

The project adopts the distributed development of angular2+springBoot.

The front-end is accessed by domain name, and the back-end service is provided by ip.

When uploading, there is a cross-origin issue.



 After several searches, I finally solved the problem:

Add 2 annotations to the upload method in java and you can do it



 The parameter of CrossOrigin is the address of the request, that is, the front desk address. For local development, you can directly write localhost: + port number.

 

Source: http://www.cnblogs.com/GoodHelper/archive/2017/05/08/6824562.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326802081&siteId=291194637