question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authorization Header is removed even if it should not

See original GitHub issue

After spending some time digging into this topic I think the current implementation of transformation of Authorization headers header-transforms.js does not cover all real life uses cases, even if it seems to follow specification (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials).

What I observed:

So, this hammerhead lib is used within TestCafe to proxy http requests coming from the page/application under test. In our case we use Authorization header not for HTTP Authentication, but to pass an OAuth2 token to our API backend. The token is added from within the JS application and not automatically by the browser after the user signed in (as it happens for HTTP auth). By intend we do not create XHR requests using withCredentials = true.

What happens now is (which is actual different from default browser behaviour):

When the API backend request is sent from our application under test (by TestCafe), the request is intercepted by hammerhead and because withCredentials=false the Authorization header is removed, which leads to unauthenticated request to our backend and in turn to failing tests. IMHO, this is not correct, as this specific auth header is not like the ones which are automatically send by the browser when accessing sites that required http authentication.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
JoergFiedlercommented, Jan 30, 2017

@LavrovArtem: works like a charm … thank you …

1reaction
LavrovArtemcommented, Jan 26, 2017

Hi @JoergFiedler, I understood your problem and if you created the example, it will be useful for us to check.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authorization header not cleared on selecting "No auth" #2911
Hello,. If I choose another method than "No auth", e.g. Basic Auth, in Postman and presses "Send" and then change back to "No...
Read more >
How to fix Spring Security Authorization header not being ...
After some research, I saw that I could add ",required=false" so spring would not check for it, but then still there was no...
Read more >
Authorization - HTTP - MDN Web Docs - Mozilla
The HTTP Authorization request header can be used to provide credentials that authenticate a user agent with a server, allowing access to a ......
Read more >
Can Authorization header be removed from browser using ...
We are trying to implement this use case where we have basic auth enabled in AAA, we authenticate user generate saml and post...
Read more >
how to remove Authorization http header DevCentral
What I want to do is remove the authorization header only from the LTM to the backend. From the client to the LTM...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found