4

I'm using Axios to make a secure POST call to an API. This returns an URL within the response headers under 'Location'.

I can see the URL being populated within Chrome's dev tools:

enter image description here

but the response inside JS from Axios (below) doesn't contain this information:

enter image description here

Any advice greatly received!

Community
  • 1
  • 1
Rich
  • 970
  • 2
  • 16
  • 42
  • Possible duplicate of [Axios get access to response header fields.](https://stackoverflow.com/questions/37897523/axios-get-access-to-response-header-fields) – Rita Kondratyeva Sep 02 '17 at 17:31
  • Please find another detailed discussion regarding the same [here](https://github.com/axios/axios/issues/746) – Apurva jain Oct 02 '17 at 14:57

1 Answers1

2

Possibly it occurs because you are doing a cors request that doesn't expose location header by default.

You need to add this Cors Configuration to your server side app.

Access-Control-Expose-Headers: Location

as you can see here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers

rcarubbi
  • 123
  • 1
  • 10