Unable to see extra headers from response
See original GitHub issueWhen trying to access response headers, the only header i can see is Content-Type
although server replies with extra ones.
I’m able to get whole response with no issue using http resource:
this.serverRequest().then(
response => {
console.log(response.headers)
},
error => {}
)
Consider next server response:
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:Authorization, Content-Type
Access-Control-Allow-Methods:OPTIONS, POST
Access-Control-Allow-Origin:http://localhost:4000
Connection:keep-alive
Content-Length:112
Content-Type:application/json
Date:Sun, 26 Nov 2017 21:50:49 GMT
Server:Cowboy
Via:1.1 vegur
X-Password-Token: 1234567890abcdef
X-Server-Time:1511733049
What is Expected?
Expected to see at least X-Password-Token
and X-Server
in console log (ideally, one would see all headers returned by server)
What is actually happening?
Seeing only content-type
in headers mapping console log
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Unable to access custom response header in frontend ...
I can see the header in the chrome dev-tools console, but I cannot get access to the header through axios. chrome dev tools...
Read more >How to troubleshoot the error "Failed to process response ...
In almost every event, this error is caused by a connection failure. The error is correct, the service did not receive any response...
Read more >Access-Control-Expose-Headers - HTTP - MDN Web Docs
The Access-Control-Expose-Headers response header allows a server to indicate which response headers should be made available to scripts ...
Read more >Adding HTTP headers to CloudFront responses
A Cache-Control header to control browser caching. · An Access-Control-Allow-Origin header to enable cross-origin resource sharing (CORS). · A set of common ...
Read more >HTTP header manipulation - Envoy Proxy
Custom request/response headers can be added to a request/response at the weighted cluster, route, virtual host, and/or global route configuration level. See ......
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 FreeTop 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
Top GitHub Comments
Well, it is a browser issue indeed. Browsers need an
access-control-expose-headers
header to make them avilable when using thefetch
API while performing a CORS request (more here).In short: you must set your server response with the comma-separated list of headers list you want to expose to your response.
Example:
access-control-expose-headers: x-password-token,x-server-time
I strongly recommend you to use all-lower-case as I’ve had some trouble while using others.
@stgogm you’re right, it works.