I'm using create-react-app in a pretty vanilla setup, I started using the proxy field to redirect the requests when developing the app.
Here is my axios request:
const response = await axios({
method: 'POST',
url: '/api/payment/subscribe',
data: {
email,
pricingId,
paymentMethodId: paymentMethod.id
},
headers: {
Accept: 'application/json',
Authorization: `Bearer ${idToken}`
}
})
You can see I set the Authorization header, however when the request reaches my back-end there is no trace of the authorization header:
functions: Beginning execution of "api"
> api call /api/payment/subscribe
> ROPO BACKEND HEADERS {
> 'x-forwarded-host': 'localhost:5000',
> 'x-original-url': '/api/payment/subscribe',
> pragma: 'no-cache',
> 'cache-control': 'no-cache, no-store',
> cookie: '',
> connection: 'keep-alive',
> 'user-agent': 'FirebaseCLI/8.18.0',
> 'x-client-version': 'FirebaseCLI/8.18.0',
> accept: '*/*',
> 'accept-encoding': 'gzip,deflate',
> host: 'localhost:5001',
> 'transfer-encoding': 'chunked'
> }
> No Firebase ID token was passed as a Bearer token in the Authorization header. Make sure you authorize your request by providing the following HTTP header: Authorization: Bearer <Firebase ID Token> or by passing a "__session" cookie.
Am I doing something incorrectly or the create-react-app proxy really does strip the headers of any proxied request?
Cheers