Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Auth not working with browsers #1

Closed
flo-assling opened this issue Nov 11, 2022 · 4 comments · Fixed by #3
Closed

Basic Auth not working with browsers #1

flo-assling opened this issue Nov 11, 2022 · 4 comments · Fixed by #3

Comments

@flo-assling
Copy link

flo-assling commented Nov 11, 2022

Thank you for providing this script.
Works perfectly without authentication.
But when starting with basic auth, and adding the correct credentials to my browser, I always get "Unauthorized"...
Tested starting with with --basic-auth 'user:pass' // --basic-auth user:pass // -basic-auth 'user:pass' // -basic-auth user:pass

@kanwairen123
Copy link

It seems the browser not sending the "Proxy-Authorization" header to proxy server, I'm also struggling with the issue, if you have a solution, kindly share with me, thank you!

@jthomperoo
Copy link
Owner

jthomperoo commented Dec 4, 2023

Sorry for such a slow fix on this.

Thanks @kanwairen123 you were right and started me in the right direction - digging into the Chrome spec this proxy was using the wrong responses. For HTTP auth to work with browsers they need to not respond with a 401 Unauthorized on authorization failure, but instead a 407 Proxy Authentication Required, and to return the Proxy-Authenticate header with the authorization type (Basic for this proxy).

Read more about it here:
https://www.chromium.org/spdy/spdy-authentication/#proxy-authentication

I've put a fix together in this pull request: #3

Just going to do some sanity testing around this and I'll merge + cut a new version.

The behaviour will be this:

  1. Set up your proxy, for my Mac it is done through system settings for Chrome.
  2. When I load a site on Chrome it will prompt me for the authentication details.
  3. When I put those in the authentication works for me.

@jthomperoo jthomperoo changed the title Basic Auth not working Basic Auth not working with browsers Dec 4, 2023
@jthomperoo
Copy link
Owner

Available with version v1.1.1, let me know if this solves it for you :)

@kanwairen123
Copy link

kanwairen123 commented Dec 4, 2023

Available with version v1.1.1, let me know if this solves it for you :)

Thanks, works as expected now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants