TH1981
TH1981

Reputation: 3193

Laravel Redirect:: not working correctly on production site

I'm not sure how to explain this fully, so please bear with.

I'm using Laravel. My dev environment is on a vagrant box and is working fine. I've just uploaded to the production site and am having some issues. The production site is a dedicated server running CentOS.

I have a login that processes through a SessionsController. On submission, we use Session::store() to redirect either to the homepage if successful, or to the login page if there's an error, like this:

    public function store()
{
    $input = Input::all();
    $attempt = Auth::attempt([
        'email' => $input['email']
        , 'password' => $input['password']
    ]);

    if($attempt)
    {
        return Redirect::home()->with(['flash_message'=>'You have been logged in.']);
    }
    else
    {
        return Redirect::back()->with(['flash_message'=>'Your UserName or Password are incorrect. Please try again']);
    }
}

Again, this is working fine on the dev environment. On the production server however, I get a page that loads in between, and the flash message info isn't pulling through.

I get the same thing if I try to use any of the other functionality, such as creating a new user. The user is added, but because the screen /user shows with a message that says: "Redirecting to site.com/user" I do not get the flash message feedback.

I suspect this is an issue in the production server settings as it's working as expected in the dev environment, but am not sure where to look.

Upvotes: 2

Views: 699

Answers (1)

TH1981
TH1981

Reputation: 3193

I've just found the solution: http://forumsarchive.laravel.io/viewtopic.php?id=11742

There was a bloody space in my routes file that caused it to load incorrectly on the production server. Still not sure why it worked on the dev environment though...

Upvotes: 1

Related Questions