Fix MTR API path: nginx rewrites diag_path prefix, backend accepts full paths
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
174fee0078
commit
eeae08de1a
@@ -187,7 +187,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
|
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
parsed = urlparse(self.path)
|
parsed = urlparse(self.path)
|
||||||
if parsed.path not in ("/mtr", "/api/mtr"):
|
if not (parsed.path in ("/mtr", "/api/mtr") or parsed.path.endswith("/api/mtr")):
|
||||||
self._send_json(404, {"error": "not found"})
|
self._send_json(404, {"error": "not found"})
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -462,7 +462,7 @@ server {
|
|||||||
location ^~ ${diag_path}api/mtr {
|
location ^~ ${diag_path}api/mtr {
|
||||||
limit_req zone=diag_api burst=2 nodelay;
|
limit_req zone=diag_api burst=2 nodelay;
|
||||||
limit_conn per_ip 2;
|
limit_conn per_ip 2;
|
||||||
proxy_pass http://127.0.0.1:${mtr_backend_port};
|
proxy_pass http://127.0.0.1:${mtr_backend_port}/api/mtr;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header X-Real-IP \$remote_addr;
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
|
|||||||
Reference in New Issue
Block a user