diff --git a/api-gateway/src/main/resources/bootstrap-dev.yml b/api-gateway/src/main/resources/bootstrap-dev.yml index 539ce7c..5c0793c 100644 --- a/api-gateway/src/main/resources/bootstrap-dev.yml +++ b/api-gateway/src/main/resources/bootstrap-dev.yml @@ -5,10 +5,10 @@ spring: - 192.168 #注册到nacos中心优先匹配的IP gateway: routes: - - id: heyu-api-user-api - uri: lb://heyu-api-user-api + - id: api-interface + uri: lb://api-interface predicates: - - Path=/api-user/** + - Path=/api-interface/** filters: # 转发时去掉一层路径 - StripPrefix=1 diff --git a/api-gateway/src/main/resources/bootstrap-online.yml b/api-gateway/src/main/resources/bootstrap-online.yml index c508d58..e774819 100644 --- a/api-gateway/src/main/resources/bootstrap-online.yml +++ b/api-gateway/src/main/resources/bootstrap-online.yml @@ -16,3 +16,33 @@ spring: # 共享配置 #shared-configs: # - application.${spring.cloud.nacos.config.file-extension} + inetutils: + preferredNetworks: + - 192.168 #注册到nacos中心优先匹配的IP + gateway: + routes: + - id: api-interface + uri: lb://api-interface + predicates: + - Path=/api-interface/** + filters: + # 转发时去掉一层路径 + - StripPrefix=1 + - id: heyu-api-websocket + uri: lb://heyu-api-websocket + predicates: + - Path=/api-websocket/** + filters: + # 转发时去掉一层路径 + - StripPrefix=1 + globalcors: + corsConfigurations: + '[/**]': + # 允许携带认证信息 + allow-credentials: true + # 允许跨域的源(网站域名/ip),设置*为全部 + allowedOriginPatterns: "*" + # 允许跨域的method, 默认为GET和OPTIONS,设置*为全部 + allowedMethods: "*" + # 允许跨域请求里的head字段,设置*为全部 + allowedHeaders: "*" \ No newline at end of file diff --git a/api-gateway/src/main/resources/bootstrap.yml b/api-gateway/src/main/resources/bootstrap.yml index 8c6b851..abed308 100644 --- a/api-gateway/src/main/resources/bootstrap.yml +++ b/api-gateway/src/main/resources/bootstrap.yml @@ -2,7 +2,7 @@ server: port: 8080 spring: application: - name: heyu-api-gateway + name: api-gateway profiles: active: dev main: