application.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. server:
  2. port: 6000
  3. spring:
  4. application:
  5. name: gateway
  6. profiles:
  7. active: @profile.active@
  8. cloud:
  9. loadbalancer:
  10. ribbon:
  11. enabled: false
  12. gateway:
  13. # 默认过滤器(对所有 route 均生效)
  14. default-filters:
  15. # 限流配置
  16. - name: MyRequestRateLimiter
  17. args:
  18. # 如果 keyResolver 返回空 key 则拒绝请求返回 403, 默认 true 表示拒绝, false 表示允许访问
  19. deny-empty-key: false
  20. # 自定义的 KeyResolver(从请求 exchange 解析 id 来区分独立的限流单元, id 可以是 userId, remoteAddr, sessionId 等)
  21. key-resolver: "#{@keyResolver}"
  22. # rate-limiter: "#{@myRateLimiter}"
  23. # my-rate-limiter.requestedTokens: 1
  24. rate-limiter: "#{@redisRateLimiter}"
  25. # 令牌桶算法每秒补充的 token 数量(每秒的请求数量)
  26. redis-rate-limiter.replenishRate: 100
  27. # 令牌桶算法的 token 最大数量(每秒的最大请求数量)
  28. redis-rate-limiter.burstCapacity: 150
  29. # 单次请求消费的 token 数量
  30. redis-rate-limiter.requestedTokens: 1
  31. routes:
  32. - id: account-router
  33. # spring-cloud-starter-zookeeper-discovery 提供服务发现功能
  34. uri: lb://account-service
  35. predicates:
  36. - Path=/api/account/**
  37. filters:
  38. - StripPrefix=0
  39. - id: static-router
  40. uri: lb://account-service
  41. predicates:
  42. - Path=/dist/images/**
  43. filters:
  44. - StripPrefix=0
  45. - id: auth-router
  46. uri: lb://account-service
  47. predicates:
  48. - Path=/api/auth/**
  49. filters:
  50. - StripPrefix=0
  51. - id: oauth-router
  52. uri: lb://account-service
  53. predicates:
  54. - Path=/oauth/**
  55. filters:
  56. - StripPrefix=0
  57. ###############################################################################
  58. - id: user-router
  59. uri: lb://user-service
  60. predicates:
  61. - Path=/api/user/**
  62. filters:
  63. - StripPrefix=0
  64. ###############################################################################
  65. - id: content-router
  66. uri: lb://content-service
  67. predicates:
  68. - Path=/api/content/**
  69. filters:
  70. - StripPrefix=0
  71. - id: timeline-router
  72. uri: lb://content-service
  73. predicates:
  74. - Path=/api/timeline/**
  75. filters:
  76. - StripPrefix=0
  77. - id: search-router
  78. uri: lb://content-service
  79. predicates:
  80. - Path=/api/search/**
  81. filters:
  82. - StripPrefix=0
  83. - id: comment-router
  84. uri: lb://content-service
  85. predicates:
  86. - Path=/api/comment/**
  87. filters:
  88. - StripPrefix=0
  89. - id: mall-router
  90. uri: lb://content-service
  91. predicates:
  92. - Path=/api/mall/**
  93. filters:
  94. - StripPrefix=0
  95. - id: geo-router
  96. uri: lb://content-service
  97. predicates:
  98. - Path=/api/geo/**
  99. filters:
  100. - StripPrefix=0
  101. - id: im-router
  102. uri: lb://content-service
  103. predicates:
  104. - Path=/api/chat/**
  105. filters:
  106. - StripPrefix=0
  107. ###############################################################################
  108. - id: data-router
  109. uri: lb://data-service
  110. #uri: http://192.168.0.39:6005
  111. predicates:
  112. - Path=/api/data/**
  113. filters:
  114. - StripPrefix=0
  115. ###############################################################################
  116. - id: file-router
  117. uri: lb://file-service
  118. predicates:
  119. - Path=/api/file/**
  120. filters:
  121. - StripPrefix=0
  122. - id: oss-router
  123. uri: lb://file-service
  124. predicates:
  125. - Path=/api/oss/**
  126. filters:
  127. - StripPrefix=0
  128. ###############################################################################
  129. - id: message-websocket
  130. uri: lb:ws://message-service
  131. predicates:
  132. - Path=/ws/**
  133. - id: message-router
  134. uri: lb://message-service
  135. predicates:
  136. - Path=/api/message/**
  137. ###############################################################################
  138. - id: log-websocket
  139. uri: lb:ws://search-service
  140. predicates:
  141. - Path=/logws/**
  142. - id: search1-router
  143. uri: lb://search-service
  144. predicates:
  145. - Path=/api/search1/**
  146. - id: tnb-router
  147. uri: lb://search-service
  148. predicates:
  149. - Path=/api/tnb/**
  150. filters:
  151. - StripPrefix=0
  152. # gateway:
  153. # globalcors:
  154. # cors-configurations:
  155. # '[/**]':
  156. # allowedOrigins: "*"
  157. # allowedMethods: "*"
  158. # allowedHeaders: "*"
  159. eureka:
  160. instance:
  161. prefer-ip-address: true
  162. client:
  163. register-with-eureka: true
  164. fetch-registry: true