当前位置:   article > 正文

【跨域问题】When allowCredentials is true, allowedOrigins cannot contain the special value “*“ since that

when allowcredentials is true, allowedorigins cannot contain the special val

在springboot中配置跨域时,出现When allowCredentials is true, allowedOrigins cannot contain the special value “*” since that cannot be set on the “Access-Control-Allow-Origin” response header. To allow credentials to a set of origins, list them explicitly or consider using “allowedOriginPatterns” instead.

浏览器显示500服务器报错
需要将配置类中的corsConfiguration.addAllowedOrigin("");修改成为corsConfiguration.addAllowedOriginPattern("");

修改前的代码:

package com.oolong.gulimall.gateway.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.reactive.CorsWebFilter;
import org.springframework
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/1018290
推荐阅读
相关标签
  

闽ICP备14008679号