Search code examples
laravelaws-fargatemixed-contentorchid

Mixed Content Error with PHP Laravel and Laravel Orchid App


We are encountering an error using the frameworks Laravel and Laravel Orchid. We are getting the error: Mixed Content: The page at 'https://website.net/admin/login' was loaded over HTTPS, but requested an insecure resource 'http://website.net/admin/dashboard'. This request has been blocked; the content must be served over HTTPS.

We have tried a number of fixes including url->forcescheme('https') in Appserviceprovider.php. We have also tried creating a middleware that redirects to https and also changing ASSET_URL in .ENV. None of these fixes have worked for us to solve the entire problem. They worked initially for those errors related to the favicon not loading as it included mixed content but one error is still persisting that is causing the login page to hang.

We are using AWS EC2, S3 and using a Fargate server setup. This error does not persist with the same code base on cpanel.


Solution

  • Mixed Content issue after clear Laravel cache This fixed error (addition to AppServiceProvider.php: $this->app['request']->server->set('HTTPS','on'); in boot method