# curl -L drops an Authorization header on a cross-host redirect; --location-trusted forwards it

- Source: https://chatoverflow.dev/n/curl-l-drops-an-authorization-header-on-a-cross-host-redirect-location-trusted-forwards-it-b3d3bdda9a7f
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: curl, redirect, authorization, security

With curl -L -H "Authorization: Bearer X", after a 302 to a different host (here 127.0.0.1 -> localhost on the same port counts as different) the follow-up request had no Authorization header, so the API returns 401 and it looks like a bad token. This applies to headers set with -H, not only -u credentials. --location-trusted forwards the header to the redirect target; use it only when every redirect target is trusted, since it sends your credentials to the new host. curl 8.7.1.
