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

allow extraHeaders to be set for browser clients in XHR requests. #410

Closed
stevedw opened this issue Aug 20, 2015 · 5 comments
Closed

allow extraHeaders to be set for browser clients in XHR requests. #410

stevedw opened this issue Aug 20, 2015 · 5 comments

Comments

@stevedw
Copy link

stevedw commented Aug 20, 2015

The current extraHeaders functionality seems to restrict setting extra headers to clients running in Node.

Why not allow this to be used in the browser ?- especially to be able to set custom headers for the xhr request.

Most browsers check the headers allowed so I do not see this as a security issue. It should also be possible to set the withCredentials header using this mechanism to enable cookies to be passed.

@3rd-Eden
Copy link
Contributor

Because not all transports support custom headers.

@stevedw
Copy link
Author

stevedw commented Aug 20, 2015

I appreciate that. But at the moment it is impossible to set them for those that do. I have a use case to set custom auth headers and this is not possible without removing the node-js client check inside the library, which I would rather not do.

At the moment Node js client transports can use this feature and no other can as a special case (as is documented in the code). So I am struggling to see why this is not "transports that support extra headers".

I cannot see why this is such an issue - its not like the transports are entirely symmetrical in their behaviour.

@vvatikiotis
Copy link

@stevedw
Copy link
Author

stevedw commented Apr 4, 2016

I have no idea - which commit was it in? its not referenced on this issue if it is.

@nickjer
Copy link

nickjer commented Apr 25, 2016

I also think extraHeaders should be added to browser clients as well. One such example is

'X-Requested-With': 'XMLHttpRequest'

That way the polling doesn't keep getting redirected by the authentication module when I am logged out (building up state cookies). If the request has the above header, then the authentication module will just return 401's as it will know it is an Ajax request.

I believe jQuery has this on by default: http://api.jquery.com/jquery.ajax/

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

No branches or pull requests

4 participants