0

I developed a website with a login part using Jetstream (with Fortify) to authenticate the users. In the local environment, it works fine. The production environment (via Elastic Beanstalk on AWS) does not work with the SSL certificate.

To let Laravel use HTTPS in production, I added the following code to the AppServiceProvider.

public function boot()
{
  if (App::environment('production')) {
    URL::forceScheme('https');
  } 
}

Now for all routes, it works perfectly, except for the redirect after login. Then the route is redirected with HTTP instead of HTTPS. A mixed content error shows up.

What code do I have to add or change to make it work?

To inspect all code, feel free to look at https://github.com/harmjanbeekhuis/reddingsbrigadededukers. I am happy to provide any further information required to solve this problem.

1 Answers1

8

After some more research and a lot of trial and error, I observed that the error was in the XMLHttpRequest instead of the routes. Adding the part below to the AppServiceProvider was the solution.

public function register()
  {
    if (App::environment('production')) {
      $this->app['request']->server->set('HTTPS', true);
    }
  }