nomadro/deploy/work/_smoke_host_header.py
Eric ffa456afdf Ship social join profile + SeaweedFS avatars, notify/coffee, and .com audience stack.
Pay-then-profile join desk with live card, S3 upload fallback, hydration-safe drafts; document on test9 README.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-04 02:25:05 +08:00

40 lines
1.4 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace", line_buffering=True)
CMD = r"""
set +e
echo 'direct no host'
curl -sS -m 8 -o /dev/null -w '%{http_code}\n' http://127.0.0.1:4003/api/work/v1/boards
echo 'direct Host nomadro.com'
curl -sS -m 8 -o /dev/null -w '%{http_code}\n' -H 'Host: nomadro.com' http://127.0.0.1:4003/api/work/v1/boards
curl -sS -m 8 -H 'Host: nomadro.com' http://127.0.0.1:4003/api/work/v1/boards | head -c 220; echo
echo 'direct with xf headers'
curl -sS -m 8 -o /dev/null -w '%{http_code}\n' \
-H 'Host: nomadro.com' \
-H 'X-Forwarded-For: 1.2.3.4' \
-H 'X-Forwarded-Proto: https' \
-H 'X-Forwarded-Host: nomadro.com' \
http://127.0.0.1:4003/api/work/v1/boards
curl -sS -m 8 \
-H 'Host: nomadro.com' \
-H 'X-Forwarded-Proto: https' \
-H 'X-Forwarded-Host: nomadro.com' \
http://127.0.0.1:4003/api/work/v1/boards | head -c 260; echo
# show nginx location that catches /api/work
awk '/location /, /^\s*}/' /etc/nginx/sites-enabled/nomadro.com.conf | head -120
"""
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=40, allow_agent=False, look_for_keys=False)
_, o, e = c.exec_command(CMD, timeout=45)
print(o.read().decode())
err = e.read().decode()
if err.strip():
print("STDERR", err[-800:])
c.close()