[GH-ISSUE #725] Reverse Proxy: Mixed Content Error #518

Closed
opened 2026-02-26 02:33:26 +03:00 by kerem · 10 comments
Owner

Originally created by @Nebucatnetzer on GitHub (Mar 10, 2018).
Original GitHub issue: https://github.com/koel/koel/issues/725

I've installed Keol today and so far it works quite well in the local network.
I run all my VMs behind a reverse proxy which serves the domain with SSL.
With Koel however I'm not able to get it working. I get mixed content errors:

Blocked loading mixed active content “http://koel.2li.ch/public/css/app.dfccaba1e91708e1e522.css” koel.2li.ch

I've tried quite a few things to get it working but nothing really worked.
The most promising solution was this one here:
https://stackoverflow.com/questions/29912997/laravel-routes-behind-reverse-proxy
Which I put into routes/web.php however then I get the following error:

 (1/1) BadMethodCallException

Method forceSchema does not exist.

I know there have been other similar errors but none of them seem to have been resolved completely and I think it would be good if there's a place where a setup like this is at least somewhat documented.

Originally created by @Nebucatnetzer on GitHub (Mar 10, 2018). Original GitHub issue: https://github.com/koel/koel/issues/725 I've installed Keol today and so far it works quite well in the local network. I run all my VMs behind a reverse proxy which serves the domain with SSL. With Koel however I'm not able to get it working. I get mixed content errors: ``` Blocked loading mixed active content “http://koel.2li.ch/public/css/app.dfccaba1e91708e1e522.css” koel.2li.ch ``` I've tried quite a few things to get it working but nothing really worked. The most promising solution was this one here: https://stackoverflow.com/questions/29912997/laravel-routes-behind-reverse-proxy Which I put into routes/web.php however then I get the following error: ``` (1/1) BadMethodCallException Method forceSchema does not exist. ``` I know there have been other similar errors but none of them seem to have been resolved completely and I think it would be good if there's a place where a setup like this is at least somewhat documented.
Author
Owner

@Nebucatnetzer commented on GitHub (Mar 10, 2018):

I tried to setup the TrustedProxy package for Laravel but didn't succed with that either. Unfortunately I can't run it without SSL because I have setup transport security on the main domain.

<!-- gh-comment-id:372029650 --> @Nebucatnetzer commented on GitHub (Mar 10, 2018): I tried to setup the TrustedProxy package for Laravel but didn't succed with that either. Unfortunately I can't run it without SSL because I have setup transport security on the main domain.
Author
Owner

@decaby7e commented on GitHub (Nov 21, 2018):

Same issue here while using it behind a Nginx reverse proxy. However, I run my web services behind Docker containers, which is essentially the same here.

<!-- gh-comment-id:440849460 --> @decaby7e commented on GitHub (Nov 21, 2018): Same issue here while using it behind a Nginx reverse proxy. However, I run my web services behind Docker containers, which is essentially the same here.
Author
Owner

@baumschubser commented on GitHub (Dec 3, 2018):

I tried a lot and then this worked for me (koel 3.7.2):

  • In koel root, run composer require shin1x1/laravel-force-https-url-scheme
  • In app/Http/Kernel.php add the following line as line 31:
    'Shin1x1\ForceHttpsUrlScheme\ForceHttpsUrlScheme',

The code will look like this:

protected $middleware = [
        CheckForMaintenanceMode::class,
        UseDifferentConfigIfE2E::class,
        ValidatePostSize::class,
        TrimStrings::class,
        ConvertEmptyStringsToNull::class,
        'Shin1x1\ForceHttpsUrlScheme\ForceHttpsUrlScheme', // NEW LINE
    ];

This solution relies on this package.

<!-- gh-comment-id:443902034 --> @baumschubser commented on GitHub (Dec 3, 2018): I tried a lot and then this worked for me (koel 3.7.2): * In koel root, run `composer require shin1x1/laravel-force-https-url-scheme` * In `app/Http/Kernel.php` add the following line as line 31: `'Shin1x1\ForceHttpsUrlScheme\ForceHttpsUrlScheme',` The code will look like this: ``` protected $middleware = [ CheckForMaintenanceMode::class, UseDifferentConfigIfE2E::class, ValidatePostSize::class, TrimStrings::class, ConvertEmptyStringsToNull::class, 'Shin1x1\ForceHttpsUrlScheme\ForceHttpsUrlScheme', // NEW LINE ]; ``` This solution relies on [this package](https://github.com/shin1x1/laravel-force-https-url-scheme).
Author
Owner

@Redsandro commented on GitHub (Feb 18, 2019):

The solution by @baumschubser works for me. Except the require command hangs.

I had to:

  • composer require shin1x1/laravel-force-https-url-scheme
  • ^C (Ctrl + C)
  • composer update
  • composer install
  • Add 'Shin1x1\ForceHttpsUrlScheme\ForceHttpsUrlScheme' to Kernel.php

The problem is, everything is undone when watchtower downloads a new docker container.

It would be much appreciated if @phanan could implement functionality that allows running the koel container (e.g. above fix configurable) behind a proxy container, as this is increasingly common.

<!-- gh-comment-id:464912997 --> @Redsandro commented on GitHub (Feb 18, 2019): The solution by @baumschubser works for me. Except the `require` command hangs. I had to: * `composer require shin1x1/laravel-force-https-url-scheme` * `^C` (Ctrl + C) * `composer update` * `composer install` * Add `'Shin1x1\ForceHttpsUrlScheme\ForceHttpsUrlScheme'` to `Kernel.php` The problem is, everything is undone when `watchtower` downloads a new docker container. It would be much appreciated if @phanan could implement functionality that allows running the koel container (e.g. above fix configurable) behind a proxy container, as this is increasingly common.
Author
Owner

@Redsandro commented on GitHub (Feb 20, 2019):

Something for people who are getting bored from doing this every time again:

docker exec -t --user 65534:100 koel composer require shin1x1/laravel-force-https-url-scheme -d /opt/koel
docker exec -t --user 65534:100 koel composer update -d /opt/koel
docker exec -t --user 65534:100 koel composer install -d /opt/koel
docker exec -t --user 65534:100 koel sed -i "/ConvertEmptyStringsToNull::class,/a 'Shin1x1\\ForceHttpsUrlScheme\\ForceHttpsUrlScheme'," /opt/koel/app/Http/Kernel.php

Note: Replace --user with your own values.

<!-- gh-comment-id:465644916 --> @Redsandro commented on GitHub (Feb 20, 2019): Something for people who are getting bored from doing this every time again: ```bash docker exec -t --user 65534:100 koel composer require shin1x1/laravel-force-https-url-scheme -d /opt/koel docker exec -t --user 65534:100 koel composer update -d /opt/koel docker exec -t --user 65534:100 koel composer install -d /opt/koel docker exec -t --user 65534:100 koel sed -i "/ConvertEmptyStringsToNull::class,/a 'Shin1x1\\ForceHttpsUrlScheme\\ForceHttpsUrlScheme'," /opt/koel/app/Http/Kernel.php ``` __Note:__ Replace `--user` with your own values.
Author
Owner

@nebulade commented on GitHub (Apr 1, 2019):

I am looking into packaging koel for Cloudron and hit the same issue. As far as I understand the env file, shouldn't those URLs be generated from the APP_URL variable?

<!-- gh-comment-id:478465780 --> @nebulade commented on GitHub (Apr 1, 2019): I am looking into packaging koel for [Cloudron](https://cloudron.io/) and hit the same issue. As far as I understand the env file, shouldn't those URLs be generated from the `APP_URL` variable?
Author
Owner

@mbreedlove commented on GitHub (Oct 28, 2019):

I agree with @nebulade, URLs should be generated from APP_URL, however, changing APP_URL seems to have no effect.

<!-- gh-comment-id:547119556 --> @mbreedlove commented on GitHub (Oct 28, 2019): I agree with @nebulade, URLs should be generated from `APP_URL`, however, changing `APP_URL` seems to have no effect.
Author
Owner

@BrookeDot commented on GitHub (Apr 23, 2020):

I'm closing this as the initial issue has seemed to be resolved. If APP_URL still is not behaving as expected please open a new issue to address that.

<!-- gh-comment-id:618153487 --> @BrookeDot commented on GitHub (Apr 23, 2020): I'm closing this as the initial issue has seemed to be resolved. If `APP_URL` still is not behaving as expected please open a new issue to address that.
Author
Owner

@sugartarou commented on GitHub (Dec 30, 2023):

What is the solution for latest(6.11.5) ?
I tried above solution, but not worked.

<!-- gh-comment-id:1872478288 --> @sugartarou commented on GitHub (Dec 30, 2023): What is the solution for latest(6.11.5) ? I tried above solution, but not worked.
Author
Owner

@sugartarou commented on GitHub (Dec 30, 2023):

Sorry, I found the solution for this.
I set FORCE_HTTPS=true in .env.

<!-- gh-comment-id:1872482859 --> @sugartarou commented on GitHub (Dec 30, 2023): Sorry, I found the solution for this. I set FORCE_HTTPS=true in .env.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#518
No description provided.