1

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.

Dustin Brownell
  • 817
  • 7
  • 10
  • http://stackoverflow.com/questions/21552604/how-to-define-a-laravel-route-with-a-parameter-that-contains-a-slash-character – Kapil gopinath May 23 '14 at 05:18
  • http://forumsarchive.laravel.io/viewtopic.php?id=5447 – Kapil gopinath May 23 '14 at 05:18
  • @Kapilgopinath What's the meaning of those links? Did you read the first one you posted? Where are the "slashes in the url" in OP's question? – Damien Pirsy May 23 '14 at 05:19
  • Damien I guess the url format used by Dustin is not a right one. The urls that I posted gives some insight to the right way of creating url's. Moreover the first post also mentions some issue with the slash character when used in the url. – Kapil gopinath May 23 '14 at 05:26
  • 1
    Dustin - I tried your code - and it works for me on a nginx server on Laravel 4.1. There must be something wrong with your server setup somewhere for the redirect to index.php perhaps? – Laurence May 23 '14 at 06:12
  • Thanks for the test @TheShiftExchange that at least confirmed that it is not a Laravel issue and got me looking back at Nginx. Looks like there was a broken symlink in my Nginx sites. – Dustin Brownell May 23 '14 at 07:40

1 Answers1

2

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
Dustin Brownell
  • 817
  • 7
  • 10