spring cloud gateway解决跨域问题

直接在配置文件中加入以下信息

      globalcors:
        corsConfigurations:
          '[/**]':
            allowedHeaders: "*"
            allowedOrigins: "*"
            allowCredentials: true
            allowedMethods:
              - GET
              - POST
              - DELETE
              - PUT
              - OPTION

 注:在网关解决跨域了,就不要在子服务里在解决跨域了,否则会产生返回状态码为200,而没有返回内容的情况

猜你喜欢

转载自blog.csdn.net/u013008898/article/details/120805313
今日推荐