application.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. server:
  2. port: 9000
  3. spring:
  4. application:
  5. name: gateWay-server
  6. profiles:
  7. active: dev
  8. # cloud:
  9. # gateway:
  10. # globalcors: # 全局 CORS 配置
  11. # cors-configurations:
  12. # '[/**]': # 对所有路径应用此 CORS 配置
  13. # # --- 修改这里 ---
  14. # # 将 "*" 改回具体的开发环境地址模式
  15. # allowedOriginPatterns:
  16. # - "http://localhost:*" # 允许来自 http://localhost 的任意端口
  17. # - "http://127.0.0.1:*" # 允许来自 http://127.0.0.1 的任意端口
  18. # # --- ↑↑↑ 关键修改 ↑↑↑ ---
  19. # # 如果你的前端运行在特定端口,例如 8080,也可以用更精确的 (但上面的模式更灵活):
  20. # # allowedOrigins: "http://localhost:8080" # 注意这里用 allowedOrigins
  21. #
  22. # allowedMethods:
  23. # - "GET"
  24. # - "POST"
  25. # - "PUT"
  26. # - "DELETE"
  27. # - "OPTIONS"
  28. # allowedHeaders: "*"
  29. # allowCredentials: true # 保留 true,因为你需要凭证
  30. # maxAge: 360000
  31. #
  32. ## --- 仍然重要的提醒 ---
  33. ## 检查是否使用了 Spring Security。如果使用了,强烈建议将 CORS 配置
  34. ## 统一放在 Spring Security 的配置中,并移除或注释掉这里的 globalcors 部分,
  35. ## 以避免配置冲突。
  36. ## ---
  37. logging:
  38. config: classpath:log4j2.xml