Skip to content

Commit 80e8094

Browse files
committed
v14.0-G9: add deploy/fix_nginx.py; docs send-code 405 fix
1 parent 918b65b commit 80e8094

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

deploy/fix_nginx.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import re
2+
3+
with open('/etc/nginx/sites-enabled/testpilot', 'r') as f:
4+
content = f.read()
5+
6+
auth_block = ''' # Auth 直接代理(插件直连,路径映射到 /api/v1/auth/)
7+
location /auth/ {
8+
proxy_pass http://127.0.0.1:8900/api/v1/auth/;
9+
proxy_set_header Host $host;
10+
proxy_set_header X-Real-IP $remote_addr;
11+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
12+
proxy_set_header X-Forwarded-Proto $scheme;
13+
proxy_read_timeout 120s;
14+
}
15+
16+
'''
17+
18+
if 'location /auth/' not in content:
19+
content = content.replace(' # API 代理', auth_block + ' # API 代理')
20+
with open('/etc/nginx/sites-enabled/testpilot', 'w') as f:
21+
f.write(content)
22+
print("OK: /auth/ block added")
23+
else:
24+
print("SKIP: already exists")

0 commit comments

Comments
 (0)