Request header returning null when deployed on server.
I have an application completely running on the local server. When I deployed it to AMAZON LINUX EC2, the request header is giving null.
I am using request()->header('company_id') in my controller and it is giving null in the output.
My whole application is breaking because of this. Please let me know about the issue.
Thank you for the reply.
I am not using ELB in my case.
This is my request header and I can see company_id in the request header
Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Access-Control-Allow-Origin: *
Authorization: Bearer fBjK2V4BxkZ6Iw82vmFZLh03kHw7GW6wPAOQ9gP7bQvnHegdCSkAW16vfh7h
company_id: 1
Connection: keep-alive
Host: ***************************
Origin: ***************************
Referer: ***************************
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36
I can't access company_id in the controller. Please guide me what are the configuration changes I have to do on EC2.
Hello, Thank you for your reply.
Just for them who might get into this issue, please don't use underscore '_' in the header name. It gets stripped.
So, in my case instead of using company_id, I have used company-id in the header. Now, everything is working properly.
@VijayKadiyam Thank you so much!
I've been stuck with this for days!! all because of using the _
Please or to participate in this conversation.