# Pingora canary handoff snippet. # 中文注释:本文件只提供人工 include 后的 Nginx -> Pingora 试跑入口,不默认承接公网流量。 # 启用前复制到目标机并替换 __GENARRATIVE_PINGORA_PROBE_TOKEN__,确认只允许可信来源访问。 location = /__genarrative_pingora_canary/healthz { allow 127.0.0.1; allow ::1; deny all; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Request-Id $request_id; proxy_set_header X-Genarrative-Pingora-Probe "__GENARRATIVE_PINGORA_PROBE_TOKEN__"; add_header X-Genarrative-Nginx-Handoff pingora-canary always; proxy_pass http://127.0.0.1:18081/__genarrative_pingora/healthz; } location ~ ^/__genarrative_pingora_canary/v1/database/[^/]+/subscribe$ { allow 127.0.0.1; allow ::1; deny all; rewrite ^/__genarrative_pingora_canary(/.*)$ $1 break; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Request-Id $request_id; proxy_read_timeout 3600s; add_header X-Genarrative-Nginx-Handoff pingora-canary always; proxy_pass http://127.0.0.1:18081; } location /__genarrative_pingora_canary/ { allow 127.0.0.1; allow ::1; deny all; rewrite ^/__genarrative_pingora_canary(/.*)$ $1 break; proxy_http_version 1.1; proxy_buffering off; proxy_read_timeout 3600s; proxy_send_timeout 3600s; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Request-Id $request_id; proxy_set_header X-Genarrative-Pingora-Canary "nginx-prefixed"; add_header X-Accel-Buffering no always; add_header X-Genarrative-Nginx-Handoff pingora-canary always; proxy_pass http://127.0.0.1:18081; }