application.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. server:
  2. port: 1080
  3. spring:
  4. application:
  5. name: gateway
  6. # cloud:
  7. # nacos:
  8. # server-addr: 192.168.1.66:8848,192.168.1.67:8848,192.168.1.68:8848
  9. gateway:
  10. globalcors: # 全局的跨域处理
  11. add-to-simple-url-handler-mapping: true # 解决options请求被拦截问题
  12. corsConfigurations:
  13. '[/**]':
  14. allowedOrigins: # 允许哪些网站的跨域请求
  15. - "http://localhost:80"
  16. allowedMethods: # 允许的跨域ajax的请求方式
  17. - "GET"
  18. - "POST"
  19. - "DELETE"
  20. - "PUT"
  21. - "OPTIONS"
  22. allowedHeaders: "*" # 允许在请求中携带的头信息
  23. allowCredentials: true # 是否允许携带cookie
  24. maxAge: 360000 # 这次跨域检测的有效期
  25. routes:
  26. - id: nacos-1
  27. uri: http://192.168.1.66:8848
  28. predicates:
  29. - Path=/**
  30. filters:
  31. - StripPrefix=1
  32. - id: nacos-2
  33. uri: http://192.168.1.67:8848
  34. predicates:
  35. - Path=/**
  36. filters:
  37. - StripPrefix=1
  38. - id: nacos-3
  39. uri: http://192.168.1.68:8848
  40. predicates:
  41. - Path=/**
  42. filters:
  43. - StripPrefix=1