更新生产环境配置,修改 API 基础地址为新的域名,并在 Vite 配置中添加手动分块设置以优化构建输出。
This commit is contained in:
32
apache.htaccess
Normal file
32
apache.htaccess
Normal file
@@ -0,0 +1,32 @@
|
||||
# Apache .htaccess 配置文件
|
||||
# 放置在 dist 目录下
|
||||
# 解决 Vue SPA 应用的路由问题
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
|
||||
# 处理预检请求
|
||||
RewriteCond %{REQUEST_METHOD} OPTIONS
|
||||
RewriteRule ^(.*)$ $1 [R=200,L]
|
||||
|
||||
# 静态资源直接访问
|
||||
RewriteCond %{REQUEST_FILENAME} -f
|
||||
RewriteRule ^ - [L]
|
||||
|
||||
# API请求代理到后端(需要配置虚拟主机)
|
||||
RewriteCond %{REQUEST_URI} ^/api/
|
||||
RewriteRule ^api/(.*)$ http://192.140.164.137:18080/$1 [P,L]
|
||||
|
||||
# SPA路由回退到index.html
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . /index.html [L]
|
||||
</IfModule>
|
||||
|
||||
# CORS 头部设置
|
||||
<IfModule mod_headers.c>
|
||||
Header always set Access-Control-Allow-Origin "*"
|
||||
Header always set Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
|
||||
Header always set Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization"
|
||||
Header always set Access-Control-Max-Age "1728000"
|
||||
</IfModule>
|
||||
Reference in New Issue
Block a user