Allow Capacitor WebView origins in CORS/CSRF (#22) #19

Merged
westfarn merged 1 commits from capacitor-cors-csrf-22 into master 2026-07-26 14:04:10 -07:00
Owner

Summary

  • Supports chat_web_app#22
  • Always merge Capacitor WebView origins (https://localhost, capacitor://localhost, http://localhost) into CORS_ALLOWED_ORIGINS and CSRF_TRUSTED_ORIGINS
  • Keep CORS_ALLOW_CREDENTIALS = False (JWT header-only; no cookie credentials)

Test plan

  • uv run python manage.py test chat_backend.tests.test_settings_cors
  • OPTIONS preflight from https://localhost / capacitor://localhost against prod/beta with CORS_ORIGIN_ALLOW_ALL=false
  • Authenticated JWT GET/POST from Capacitor shell after FE #22 lands
## Summary - Supports [chat_web_app#22](https://git.aimloperations.com/ai_ml_operations/chat_web_app/issues/22) - Always merge Capacitor WebView origins (`https://localhost`, `capacitor://localhost`, `http://localhost`) into `CORS_ALLOWED_ORIGINS` and `CSRF_TRUSTED_ORIGINS` - Keep `CORS_ALLOW_CREDENTIALS = False` (JWT header-only; no cookie credentials) ## Test plan - [x] `uv run python manage.py test chat_backend.tests.test_settings_cors` - [ ] OPTIONS preflight from `https://localhost` / `capacitor://localhost` against prod/beta with `CORS_ORIGIN_ALLOW_ALL=false` - [ ] Authenticated JWT GET/POST from Capacitor shell after FE #22 lands
westfarn added 1 commit 2026-07-26 13:40:59 -07:00
Allow Capacitor WebView origins in CORS/CSRF (#22)
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 9s
bc2bc115b2
Merge https://localhost and capacitor://localhost into CORS_ALLOWED_ORIGINS
and CSRF_TRUSTED_ORIGINS so JWT API calls from native shells pass origin
checks without cookie credentials.
westfarn merged commit 92aa277a37 into master 2026-07-26 14:04:10 -07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_backend#19