本文主要描述使用 Caddy 部署路由使用 HTML5 History 模式的 React 项目。
生产环境我们通常会配置 https 以及反向代理,Caddy 配置文件如下。
Caddyfile
http://app.com {
redir https://{host}{uri}
}
https://app.com {
gzip
tls /app.com.pem /app.com.key
rewrite {
regexp .*
to {path} /
}
root /srv
}
https://app.com/api {
tls /app.com.pem /app.com.key
proxy / http://backend.app
}
网友评论