If the fetch
is not sending credentials even though the request is not intended to be a cross-origin call, it could be because the request is being processed as cross-origin due to differences in protocols between the origin of the request and location of the response.
I observed that my server was returning Location
header with an http
URL, while the connection was established over https
. As a result, the browser treated the request as cross-origin and applied cross-origin rules. It's worth noting that Firefox (version 114.0.2) and Safari (version 16.1) didn't display any warnings in this scenario, but Chrome (version 114.0.5735.198) showed a (blocked:mixed-content)
error, which helped in identifying the issue.
If anyone is interested, in this particular case, SSL termination was being performed in the reverse-proxy, but the gunicorn
server was not correctly handling it due to misconfiguration, specifically related to the secure-scheme-headers
and forwarded_allow_ips
settings. After resolving these settings on the server side, fetch
started working fine in all browsers.