Halo, kalau kamu merasa tulisan saya membantu kamu, kamu bisa ucapkan terima kasih lewat saweria .

Hello, if you find this article helpful, you can express your gratitude through saweria .



Problem

The application was running, but it could not be used properly.

  1. There were no errors in the application, even after enabling debug mode (and debugbar).

  2. No errors were found in the logs (storage/logs/laravel.log).

However, when opening “Web Developer Tools” and checking the “Network” tab, there was an error related to “Mixed Content HTTP & HTTPS.”


Solution

  1. Add new variables to the .env file:

    APP_URL=https://laravel.ipang.my.id
    # add this
    ASSET_URL="${APP_URL}"
    .
    .
    .
    OCTANE_SERVER=roadrunner
    # add this
    OCTANE_HTTPS=true
    
  2. If you still encounter errors, try recompiling your assets (SASS, JS, media) in the public directory.

  3. If you use a load balancer to serve your Laravel application, here’s an Nginx configuration that will work:

location / {
    proxy_pass http://ipang_laravel;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header Host $http_host;
    proxy_set_header Connection "";
    proxy_cache_bypass $http_upgrade;
}

Notes:

  1. I haven’t changed anything in the code; I just added new variables to the .env file and recompiled my assets.

References:

  1. Stackoverflow - Mixed Content (laravel)