shoulder-gateway.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. shoulder:
  2. log:
  3. enabled: false
  4. spring:
  5. cloud:
  6. gateway:
  7. discovery:
  8. locator:
  9. enabled: true #表明gateway开启服务注册和发现的功能,并且spring cloud gateway自动根据服务发现为每一个服务创建了一个router,这个router将以服务名开头的请求路径转发到对应的服务。
  10. lowerCaseServiceId: true #是将请求路径上的服务名配置为小写(因为服务注册的时候,向注册中心注册时将服务名转成大写的了),比如以/service-hi/*的请求路径被路由转发到服务名为service-hi的服务上。
  11. filters:
  12. - StripPrefix=1 # 去掉前缀
  13. x-forwarded:
  14. prefixEnabled: false
  15. routes:
  16. - id: storage
  17. uri: lb://shoulder-storage-center
  18. predicates:
  19. - Path=/file/**
  20. filters:
  21. - StripPrefix=1
  22. - name: Hystrix
  23. args:
  24. name: default
  25. fallbackUri: 'forward:/fallback'
  26. - id: authority
  27. uri: lb://shoulder-authority-server
  28. predicates:
  29. - Path=/authority/**
  30. filters:
  31. - StripPrefix=1
  32. - name: Hystrix
  33. args:
  34. name: default
  35. fallbackUri: 'forward:/fallback'
  36. - id: msgs
  37. uri: lb://shoulder-msgs-server
  38. predicates:
  39. - Path=/msgs/**
  40. filters:
  41. - StripPrefix=1
  42. - name: Hystrix
  43. args:
  44. name: default
  45. fallbackUri: 'forward:/fallback'
  46. - id: demo
  47. uri: lb://shoulder-demo-server
  48. predicates:
  49. - Path=/demo/**
  50. filters:
  51. - StripPrefix=1
  52. - name: Hystrix
  53. args:
  54. name: default
  55. fallbackUri: 'forward:/fallback'
  56. - id: order
  57. uri: lb://shoulder-order-server
  58. predicates:
  59. - Path=/order/**
  60. filters:
  61. - StripPrefix=1
  62. - name: Hystrix
  63. args:
  64. name: default
  65. fallbackUri: 'forward:/fallback'
  66. filters:
  67. - name: Hystrix
  68. args:
  69. name: default
  70. fallbackUri: 'forward:/fallback'
  71. server:
  72. port: 8760
  73. servlet:
  74. context-path: /api # = server.servlet.context-path
  75. authentication:
  76. user:
  77. header-name: token
  78. pub-key: client/pub.key # 解密