fix(doc) caddy config

approve-sys
bob 2 years ago
parent 4830ee8c64
commit 7b2489a866

@ -1,23 +1,29 @@
:8300, localhost { (CORS) {
@origin header Origin {args.0}
header @origin Access-Control-Allow-Origin "{args.0}"
header @origin Access-Control-Allow-Methods "OPTIONS,HEAD,GET,POST,PUT,PATCH,DELETE"
}
root * /data/dist :8300 {
# Vue Router history模式避免刷新后404页面字符中间不可有空格 encode zstd gzip
try_files {path} /index.html
handle_path /stage-api/* { handle_path /stage-api/* {
import CORS
uri strip_prefix /stage-api uri strip_prefix /stage-api
# 需要代理到的IP以及端口号 # 需要代理到的IP以及端口号
reverse_proxy ruoyi-admin:8080 reverse_proxy ruoyi-admin:8080
} }
handle {
root * /data/dist
# Vue Router history模式避免刷新后404页面字符中间不可有空格
try_files {path}.html {path} /index.html
file_server file_server
encode zstd gzip }
# CORS
import CORS log {
} format formatted "[{ts}] {request>remote_addr} {request>proto} {request>method} <- {status} -> {request>host} {request>uri} {request>headers>User-Agent>[0]}" {
time_format "iso8601"
}
output file "/dev/stdout"
}
(CORS) {
header replace Access-Control-Allow-Origin "*"
header replace Access-Control-Allow-Headers "*"
header replace Access-Control-Allow-Methods "*"
header replace Access-Control-Request-Method "POST, GET, OPTIONS"
} }

@ -0,0 +1,4 @@
handle_path /stage-api/handle配置顺序说明
https://caddy.community/t/caddy-with-vue-router/12352/2
Loading…
Cancel
Save