Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safari 12 replaces authorization header

we have a webserver (nginx) https://www.website.com which is protected by a basic authentication. The API https://www.website.com/api does not have a basic authentication!

The problem now is, since Safari 12 (macOS & iOS), the http header set by our javascript application with a Bearer token for /api requests is actually not sent to the server, because it is replaced with the basic token. I can see this in the network tab in the safari developer tools. As mentioned before /api is public and not protected!

Chrome e.g. does sent the correct Bearer token and not the Basic one.

When I remove the basic authentication in the nginx configuration and restart safari, everything works fine and the Bearer token is sent to the api.

It seems that safari 12 just send automatically the basic token along for every request for the domain.

Does anybody have an idea if this is a bug in safari? One solution might that we change the api target from /api to a seperate subdomain like api.website.com.

Thanks for your help.

like image 939
Sven W Avatar asked Sep 22 '18 11:09

Sven W


People also ask

Does browser automatically send Authorization header?

The HTTP Authorization request header can be used to provide credentials that authenticate a user agent with a server, allowing access to a protected resource. The Authorization header is usually, but not always, sent after the user agent first attempts to request a protected resource without credentials.

Where is Authorization header stored?

These can be stored in the browser local storage or session storage.

How do I hide Authorization header in browser?

You can't. ANY HTTP headers by default will be seen in the browser, at any time: End-to-end headers: These headers must be transmitted to the final recipient of the message; that is, the server for a request or the client for a response.


1 Answers

I can tell you that I am seeing the same issue with your proposed "api.website.com" solution. Safari seems to not care about subdomain. It seems to only care about domain.

like image 185
Ian Morris Nieves Avatar answered Oct 06 '22 13:10

Ian Morris Nieves