fix(deploy): 补充 CORS 允许来源避免跨域被拒
app-api 增加 frostgiant 域名(含 nginx 非标准 80 端口)与公网 IP 来源; admin-api 增加公网/局域网 IP 与 admin.frostgiant.vip。 Spring setAllowedOrigins 为精确字符串匹配,来源必须逐条列全。
This commit is contained in:
1 parent
8a5a381b44
commit
3faeba0589
1 file changed
+5
-1
+5
-1
@@ -78,6 +78,9 @@ services:
|
||||
# 限流/缓存用 Redis;容器内 127.0.0.1 是容器自身,必须指向编排里的 redis
|
||||
REDIS_HOST: ${REDIS_HOST:-redis}
|
||||
REDIS_PORT: ${REDIS_PORT:-6379}
|
||||
# CORS:公网入口 nginx 把 SSL 跑在 80 端口上(腾讯云安全组只放 80),
|
||||
# 浏览器 fetch 带 Origin 时端口不匹配会被 Spring CORS 拒(必须精确字符串匹配)。
|
||||
CORS_ALLOWED_ORIGINS: "https://api.frostgiant.vip:80,https://api.frostgiant.vip,http://api.frostgiant.vip,https://39.162.50.99:8081,http://localhost:3005,http://127.0.0.1:3005"
|
||||
ports:
|
||||
- "8081:8081"
|
||||
volumes:
|
||||
@@ -108,7 +111,8 @@ services:
|
||||
SERVER_PORT: "8080"
|
||||
SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE: "2GB"
|
||||
SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE: "2GB"
|
||||
CORS_ALLOWED_ORIGINS: "http://localhost:3005,http://127.0.0.1:3005,http://39.162.50.99:3005,http://192.168.31.250:3005"
|
||||
# 浏览后台时 Origin 是实际访问地址,必须精确列全:本机、局域网、公网 IP、域名。
|
||||
CORS_ALLOWED_ORIGINS: "http://localhost:3005,http://127.0.0.1:3005,http://39.162.50.99:3005,http://192.168.31.250:3005,https://api.frostgiant.vip,https://admin.frostgiant.vip"
|
||||
DB_URL: ${DB_URL:-jdbc:postgresql://db:5432/${DB_NAME:-fruitshorts}}
|
||||
# 管理端仅内网,页面上直接播放/下载裸媒资地址(不签播放签名),
|
||||
# 因此这里不启用 /files/episode/** 的签名校验;公开的 app-api 仍保持开启。
|
||||
|
||||
Reference in new issue
Block a user