You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a browser accidentally calls an endpoint without an ending slash, Starlette responds with a 307 with Location: http://example.org/api/endpoint/, which browser rightfully rejects because of mixed content blocking.
If Starlette responded with Location: /api/endpoint/ instead, browser would then just slap that relative location to the current host.
Django does it like that, but they respond with 301s:
> GET /api/endpoint HTTP/1.1
< HTTP/1.1 301 Moved Permanently
< location: /api/endpoint/
Discussed in #2651
Originally posted by rijenkii July 23, 2024
I have a following setup:
When a browser accidentally calls an endpoint without an ending slash, Starlette responds with a 307 with
Location: http://example.org/api/endpoint/
, which browser rightfully rejects because of mixed content blocking.If Starlette responded with
Location: /api/endpoint/
instead, browser would then just slap that relative location to the current host.Django does it like that, but they respond with 301s:
Related code:
starlette/starlette/routing.py
Lines 750 to 763 in c2e3a39
The text was updated successfully, but these errors were encountered: