错误场景:使用springboot访问网站页面时出现HTTP Status 500 – Internal Server Error
同时idea报错:
错误原因:跨域配置报错
在springboot版本高于2.4.0时不能使用*来设置allowedOrigins,而要使用allowedOriginPatterns作为替换
修改方法:
一、降低springboot的版本
二、使用allowedOriginPatterns替换allowedOrigins
找到原来的跨域配置
修改后的跨域配置:
重新启动springboot,问题解决!
成功访问
坚定目标,日日精进,必有所成,共勉!