How to add http Headers in react js app's response

i.am.jabi picture i.am.jabi · Oct 4, 2019 · Viewed 14.6k times · Source

I have a react js application. I want to add some http headers in the every response that's being returned from the app. Could you please suggest how to implement this !

NOTE : I am not trying to call any api with headers in request. I want my react app to respond with some custom headers in the response

Answer

i.am.jabi picture i.am.jabi · Dec 2, 2020

As Dovlet Mamenov mentioned in the comment, this has to be done on the web server wherever react app is hosted.

For example, If react app is hosted on the Apache server, then these http headers in the response should be added on the Apache server conf.