After the browser clears the cache, the springboot project cannot load the css style.

Once I had a sudden idea to clear the browser's cookies. Who knew that the css style could not be loaded after running the project?

 After checking the css error message, I found that the general reason is that this access is an http request, and there are some https requests in the css style. The same origin policy of the latest browser does not support cross-origin requests.

 So we can configure it on the server side so that our http request can access http domain name resources

Configure in application.properties

#Configure cross-origin requests so that our http can access https resources, such as the domain name resource of #https://stackpath.bootstrapcdn.com that we need to access 
"Access-Control-Allow-Origin: https://stackpath.bootstrapcdn. com"

 After configuration, we can access remote https resources and display css and js styles.

Guess you like

Origin blog.csdn.net/weixin_55347789/article/details/131717968