Laravel stripping $_GET parameters

牧云@^-^@ 提交于 2019-12-24 12:39:21

问题


I am setting up an OAuth2 callback, and Laravel appears to be stripping any parameters passed via the URL (aka GET). This includes Input::get(), Input::all(), as well as the general PHP $_GET and even $_SERVER['QUERY_STRING'].

My initial reaction was an Nginx config error. But I am able to setup a test PHP file in my laravel/public directory which simply is:

<?php var_dump($_GET)

Hitting /test.php?code=123456ABCD generates the expected dump of an single value array.

Then, in Laravel routes, I create,

Route::get('/testcallback', function(){
    var_dump(Input::all());
});

Hitting /testcallback?code=123456ABCD generates the dumping of an empty array.

Is there something I am doing in my config or routes that would cause Laravel to strip the GET parameters?

Thanks.


回答1:


This ended up being Nginx after all. Turns out the symlink between my sites-available and sites-enabled host had broken, and the (well documented) solutions to the query_string issue was not flowing through.

try_files $uri $uri/ /index.php?$query_string;

This was fixed by simply removing the sites-enabled site, and relinking it, then restarting Nginx.

sudo rm /etc/nginx/sites-enabled/{site-name}
sudo ln -s /etc/nginx/sites-available/{site-name} /etc/nginx/sites-enabled/{site-name}
sudo nginx -t
sudo service nginx reload


来源:https://stackoverflow.com/questions/23820746/laravel-stripping-get-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!