seeing 2 requests to server, one without and one with the Authorization header
See original GitHub issueAngular 4.3.3 build --prod using ahead of time compilation
When a request is made from the client via:
this.authHttp.get(url, options)
.subscribe(
data => console.log("res data:", data),
error => console.log("error:", error),
() => console.log('complete')
);
I am seeing 2 requests occur when there should only be one, correct?
The first with the initiator being the pollyfills
JS chunk which does NOT include the Authorization header.
That request is immediately followed by a second request with the initiator labeled Other
. This request DOES include the Authorization header correctly.
Is this a bug?
Does anyone know how to prevent the first request from firing?
Any help greatly appreciated.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
HTTPClient sends out two requests when using Basic Auth?
I see in Charles Proxy that there are two requests being sent. One without the Authorization: Basic ... header and one with it....
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 >Using the Authorization Header (AWS Signature Version 4)
Using the HTTP Authorization header is the most common method of providing authentication information. Except for POST requests and requests that are signed...
Read more >HTTP/1.1: Header Field Definitions
Indicates that all or part of the response message is intended for a single user and MUST NOT be cached by a shared...
Read more >Why authorization header not included in request ? - Auth0
So, I have the following two endpoints in my flask app: A public endpoint which requires no authentication process: @APP.route("/api/public") @ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for putting the link here @escardin.
@gitdisrupt the
OPTIONS
call happens to ask the server what kinds of requests it supports before making the actual intended request. It’s a browser thing rather than an Angular/angular2-jwt thing.See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
You won’t see double, only the initial request for each url should see it.