URL prefix breaks reverse proxy

We have an installation of h5p that sits behind a reverse proxy.

This code on line 1998 of h5p.classes.php causes many things such as the video controls in the video player to break:

   * Combines path with cache buster / version.
   * @param array $assets
   * @return array
  public function getAssetsUrls($assets) {
    $urls = array();

    foreach ($assets as $asset) {
      $url = $asset->path;

      // Add URL prefix if not external
      if (strpos($asset->path, '://') === FALSE) {
        $url = $this->url . $url;

      // Add version/cache buster if set
      if (isset($asset->version)) {
        $url .= $asset->version;

      $urls[] = $url;

    return $urls;

This line is the problem:

$url = $this->url . $url;

This results in a hard-coded URL that doesn't work when behind a reverse proxy.

Is there a reason why a fully-qualified hard-coded URL is needed here?

Is there any way to change this to a relative path?

thomasmars's picture

Which cms integration are you using ?
I tested this in Drupal, and it should return a relative url for your assets as long as your assets are not external. This does depend on what the base_path() for your site returns. Do you have any insight to why the $url returned is not a relative url ? In most setups $this->url will just be a "/" which would make the final URL a relative url. What is returned for you ?