0

I have an http request where I want some response headers that are, for one reason or another, unavailable to me from the response object but visible in the chrome dev tools enter image description here

But the response object from the javascript request api only contains some of these headers.

{ // response.headers cache-control: "no-cache, private", content-type: "application/json" } 

Surely, there must be a way to get things like x-ratelimit-limit as part of the response. If it's information sent to the browser, why can't it be available in a javascript http request api?

1 Answer 1

1

This looks like a CORS request. If so, response headers are restricted unless the right Access-Control-Allow-Headers header is set. This is for security reasons.

Sign up to request clarification or add additional context in comments.

2 Comments

This was the answer I was hoping to not find. Attempting to add Access-Control-Allow-Headers responds with: Request header field Access-Control-Allow-Headers is not allowed by Access-Control-Allow-Headers in preflight response. This is a public api. Does that mean the other headers are fundamentally inaccessible?
@Andrew if you don't have control over the service, then your only option is to set up your own service and proxy the public service you're trying to access.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.