danWilcz's avatar

Laravel Request. q parameter

Hi,

When I do dd($request) I can see the request array

There is one 'query' property there. On my development servers it is empty. On production however the 'query' property has itself a 'q' property which holds the path of where request came from e.g.

+query: ParameterBag {#48 ▼ #parameters: array:1 [▼ "q" => "/control/email" ] }

Why is this q, and why is it there on production and not on development?

0 likes
5 replies
bashy's avatar

I think this is how your web server is setup.

Basically, it needs to route everything after the first forward slash to the index.php file. It could be appearing as a query string.

Is q the URI you're on?

danWilcz's avatar

Is q the URI you're on?

Yes.

I think you might be right that it is some server config thing.

Its just weird that it shows up in my attributes. For example if I do:

dd($request->all())

It shows up in my attributes:

array:5 [▼ "_token" => "string that I reducted" "user_id" => "1" "subject" => "Account Activation" "description" => "yolo" "q" => "/control/email" ]

No other php globals or config variables show up but this does.

I noticed it also seems to show up in:

+server: ServerBag {#45 ▶ ▼ #parameters: array:38

as "QUERY_STRING" => "q=/control/email&"

coreyw's avatar
coreyw
Best Answer
Level 1

I'm going to bet nginx is adding the q param in your try_files.. maybe something like try_files $uri $uri/ /index.php?q=$uri&$args;

Replace that with try_files $uri $uri/ /index.php?$query_string;

4 likes

Please or to participate in this conversation.