diff --git a/iot-gateway/src/main/resources/bootstrap-dev.yml b/iot-gateway/src/main/resources/bootstrap-dev.yml index bf1ee97..818c803 100644 --- a/iot-gateway/src/main/resources/bootstrap-dev.yml +++ b/iot-gateway/src/main/resources/bootstrap-dev.yml @@ -1,5 +1,32 @@ spring: cloud: + gateway: + routes: + - id: qiuguo-iot-box-user-api + uri: lb://qiuguo-iot-box-user-api + predicates: + - Path=/iot-user/** + filters: + # 转发时去掉一层路径 + - StripPrefix=1 + - id: qiuguo-iot-box-websocket + uri: lb://qiuguo-iot-box-websocket + predicates: + - Path=/iot-websocket/** + filters: + # 转发时去掉一层路径 + - StripPrefix=1 + globalcors: + corsConfigurations: + '[/**]': + # 允许携带认证信息 + allow-credentials: true + # 允许跨域的源(网站域名/ip),设置*为全部 + allowedOriginPatterns: "*" + # 允许跨域的method, 默认为GET和OPTIONS,设置*为全部 + allowedMethods: "*" + # 允许跨域请求里的head字段,设置*为全部 + allowedHeaders: "*" config: # 如果本地配置优先级高,那么 override-none 设置为 true,包括系统环境变量、本地配置文件等配置 override-none: true @@ -28,26 +55,6 @@ spring: port: 32030 password: 123456 timeout: 5000 - gateway: - routes: - - id: qiuguo-iot-box-user-api - uri: lb://qiuguo-iot-box-user-api - predicates: - - Path=/iot-user/** - filters: - # 转发时去掉一层路径 - - StripPrefix=1 - globalcors: - corsConfigurations: - '[/**]': - # 允许携带认证信息 - allow-credentials: true - # 允许跨域的源(网站域名/ip),设置*为全部 - allowedOriginPatterns: "*" - # 允许跨域的method, 默认为GET和OPTIONS,设置*为全部 - allowedMethods: "*" - # 允许跨域请求里的head字段,设置*为全部 - allowedHeaders: "*" # 安全配置 security: # 防止XSS攻击 @@ -56,6 +63,9 @@ security: # 排除的路径 exclude-urls: - /iot-user/user/login/pwd + - /iot-user/music/search + - /iot-websocket/push/message + - /iot-websocket/websocket/box #application: # cors: # allowed-crigin-patterns: diff --git a/iot-gateway/src/main/resources/bootstrap.yml b/iot-gateway/src/main/resources/bootstrap.yml index 56c6651..0ca9480 100644 --- a/iot-gateway/src/main/resources/bootstrap.yml +++ b/iot-gateway/src/main/resources/bootstrap.yml @@ -1,5 +1,5 @@ server: - port: 8081 + port: 8082 spring: profiles: # 环境配置