Compare commits
2 Commits
379bacf023
...
3.2-nohash
| Author | SHA1 | Date | |
|---|---|---|---|
| c18893e6f3 | |||
| c64d5a96cb |
12
nginx.conf
12
nginx.conf
@@ -3,6 +3,18 @@ server {
|
|||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
|
# 👇 跨域配置开始
|
||||||
|
add_header Access-Control-Allow-Origin * always;
|
||||||
|
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||||
|
add_header Access-Control-Allow-Headers '*, Origin, X-Requested-With, Content-Type, Accept, Authorization, X-Token' always;
|
||||||
|
add_header Access-Control-Allow-Credentials 'true' always;
|
||||||
|
|
||||||
|
# 处理预检 OPTIONS 请求
|
||||||
|
if ($request_method = 'OPTIONS') {
|
||||||
|
return 204;
|
||||||
|
}
|
||||||
|
# 👆 跨域配置结束
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
COPY dist /usr/share/nginx/html
|
COPY dist /usr/share/nginx/html
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user