admin管理员组

文章数量:1417550

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:

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

Any advice greatly received!

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:

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

Any advice greatly received!

Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Jul 11, 2017 at 14:27 RichRich 1,0512 gold badges18 silver badges43 bronze badges 2
  • Possible duplicate of Axios get access to response header fields. – Rita Kondratyeva Commented Sep 2, 2017 at 17:31
  • Please find another detailed discussion regarding the same here – Apurva jain Commented Oct 2, 2017 at 14:57
Add a ment  | 

1 Answer 1

Reset to default 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/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers

本文标签: javascriptaccessing response header via AxiosStack Overflow