Question

App Platform mixed content issues

Posted June 27, 2021 325 views
DigitalOceanHTMLDigitalOcean App PlatformBuilding on DigitalOcean

I keep getting mixed content errors on my Laravel App deployed on App Platform. What I tried so far:

  1. Editing the .htaccess file to

    <IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>
    
    RewriteEngine On
    
    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    
    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]
    
    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    </IfModule>
    
  2. Made sure the .htaccess files was in both root and public folders

  3. Added APP_URL variable to environment variables and ensured it starts with “https://…”

Not really sure what else to look for at this point. The app is not loading any of my images or javascript files (all in public folder) because of mixed content issue. Anyone have any ideas?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hello @dotcomlabza

I would recommend you to run your app/website on a third party tool below:
Why No Padlock?

If there is an HTTP URL linked in your app it will show in the result and you can replace it.

If the issue persists then I would recommend you to reach out to the support team along with the website URL and error message for further help.

Best,
Dikshith

  • If the tool finds that the HTTP URLs are ones that are auto generated by Laravel Blade helpers, you will probably need to force generation of HTTPS URLs. Open the file app/Providers/AppServiceProvider.php and add the following to the boot() method:

    if($this->app->environment('production')) {
        \URL::forceScheme('https');
    }