What's 'show.connect'? I guess it's not a valid URL. Maybe you want to call Redirect::route() or even View::make()
Hi diego1araujo,
Thank you for your answer !
'show.connect' is my route's name, and Redirect::route('show.connect') does exactly the same thing as Redirect::to('show.connect'). Actually, I first used route() but it didn't work as expected, so I used to() and forgot to change it back, but both behave the same.
The "redirecting to <url>" page is working fine, because it does redirect the user after 1 or 2 seconds (via a meta refresh tag I guess) in both cases.
If I call View::make() instead of Redirect::route(), couldn't there be any security issues ? And this way, I'm skipping the connect page's controller, right ? I need this controller to display other features on the connect page.
#try not change any thing in filter.php and in side Route.php create CSRF group in side group before guest
Route::group(array('before' => 'guest'), function() {
// this will route before guest
Route 1
Route 2
............
............
// CSRF Protection group
Route::group(array('before' => 'csrf'), function() {
// this will route before Auth
Route 3
Route 4
............
............
}); // end CSRF
}); // end group guest
I don't get it. If I don't change filter.php, the auth filter will redirect to 'login' via Redirect::guest('login'). That's not a problem, I can change my connexion route and make it point to /login, but I don't think that will change something.
Grouping my routes under a guest filter will make them inaccessible for authenticated users, which could only be useful for the connexion page, am I right ? But that won't change anything to the fact that the "authenticated users only" routes won't redirect correctly to my connexion template... Or am I missing something ?
When I say "redirect correctly", I mean "redirect without blank page (with "Redirecting to <route url>" text) in-between".
By the way, thank you for your help ;)
When you create a redirect the location header is set and an HTML meta refresh is set as a fall back, something is causing the headers to not set properly and the meta refresh is used -- hence the message that you're seeing.
I'm not sure why this is happening if you say there aren't any trailing spaces or line breaks in your files, so let's go back a few steps. What happens if you use a redirect outside of filters, does the following in your routes file produce the meta refresh redirect?
Route::get('/', function()
{
return Redirect::to('/test');
});
Hi Citricsquid !
Well, you're right, I didn't look so far. Thank you for pointing this out !
So, Redirect::to('/test'); on get('/') route does what it should : it redirects without meta refresh tag. Does that mean there's a problem with the "filter.php" file or in the filter inclusion process ?
That helps isolate the problem, it's related to your filters in some way. The next step is to isolate whether the problem is related to your filters file or if it's related to an individual filter in some way, to do that do the following:
Open app/start/global.php
and comment out the final line (// require app_path().'/filters.php';
) then beneath that line (still in app/start/global.php
) re-type out your filter (or copy it from below) do not copy it from your filters.php:
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::guest('login');
});
Then see if the redirect happens properly, doing this will confirm whether or not the problem is with your filters.php or if it's elsewhere in the project.
It's not related to filters.php, the problem remains the same. I checked for special characters in my routes and filter files, but they're alright. Could it have something to do with nginx or php-fpm ? I don't think they are problematic because Route::get('/', function(){ return Redirect::to('/test'); }); worked fine...
Alright, I finally fixed my problem. It didn't come from Laravel, but from nginx.
I noticed my nginx configuration had the following
server{
[...]
location / {
index index.php index.html index.htm;
}
[...]
}
But it had to be :
server{
[...]
location / {
try_files $uri $uri/ /index.php?$args;
}
[...]
}
I hope this will help if somebody is facing the same issues.
Hello @Nyratas?
Im having same problem but with apaches as the server ... could you help me do the same changes as you did?
Thanks
I was facing this problem for 5 days. I just updated to PHP 5.5 and it started working. (apache)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community