reactjsheaderquery-stringrequest-headers

How to read request headers in React?


When the React app. is loaded, I am able to get the query param from the current page's url through `window.location.search'. Similarly, I want to read the request headers. How to read the request headers in React?


Solution

  • It's not possible to get request headers of the page in React, without sending a http request via javascript.

    Refer answers:
    How do I get http headers in React.js
    How can I read the current headers without making a new request with JS?