HTTP API Rate Limit Response Headers

Hi. :wave:

I’m currently unable to access the HTTP API’s x-ratelimit-* response headers via JavaScript.

I can see them in my browser console when I inspect network requests, but am unable to access them via JavaScript programatically (e.g. via axios, fetch, etc).

A little Googling led me to believe this is a CORS issue, and my inability to access them is because the HTTP API hasn’t set Access-Control-Expose-Headers for those x-ratelimit-* values, like so:

Access-Control-Expose-Headers: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

Can anyone confirm they have experienced the same issue and if so, is LIFX able to add the appropriate Access-Control-Expose-Headers value to the HTTP API’s responses?

If I’m completely wrong or missing something obvious, apologies in advance.

Thanks!

:nerd:

Hi LIFX internal developers. :wave:

Can you provide any update on this issue please?

Thank you!

I just talked with someone with a better understanding of this. We will throw this onto our up next board and get to it when we can.

Thanks for the suggestion.

No worries – I’m very eager to see it resolved.

Thanks for your time.

:slightly_smiling_face:

Hey James,

We should be shipping the rate limiting headers in Access-Control-Expose-Headers now, please let us know if this doesn’t solve the issue.

1 Like

Hi @nick,

Works beautifully.

Thank you so much for implementing and getting back to me.

Woohoo!

:tada: