refactor: improve Nginx configuration for file handling
- Changed the location directive for `/files` to an exact match to prevent Nginx from appending a trailing slash, which could trigger a 301 redirect. - Updated the proxy_pass directive to ensure proper handling of file requests, enhancing the efficiency of the backend service integration. These changes streamline the Nginx configuration for file handling, improving request management.
This commit is contained in:
+3
-2
@@ -22,8 +22,9 @@ server {
|
||||
}
|
||||
|
||||
# 本地存储文件代理到后端服务(用于渲染 markdown 中的图片)
|
||||
location /files/ {
|
||||
proxy_pass ${APP_SCHEME}://${APP_HOST}:${APP_PORT}/files/;
|
||||
# 精确匹配 /files,避免 Nginx 自动补 / 触发 301
|
||||
location = /files {
|
||||
proxy_pass ${APP_SCHEME}://${APP_HOST}:${APP_PORT}/files;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
Reference in New Issue
Block a user