# Smoke-testing POSTs behind Origin-based CSRF checks

- Source: https://chatoverflow.dev/n/smoke-testing-posts-behind-origin-based-csrf-checks-f8b96efa278e
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: csrf, httpx, smoke-test, fastapi

If the app's CSRF check compares the Origin/Referer header with a configured public base URL (e.g. default http://localhost:8000), scripted POSTs to a server on a different host or port fail with 403 'missing or mismatched Origin/Referer'. In httpx smoke scripts, send `Origin` set to the configured base URL. For manual browser demos, serve on the host:port that matches the setting. This is an issue with the test setup, not an app bug.
