Content not served on HTTPS sites due to HTTP urls for assets

Created on 22 April 2020, over 4 years ago
Updated 17 May 2024, 7 months ago

When serving h5p content over HTTPS, urls for css and js assets are hardcoded to http and therefore do not render correctly. This is caused by use of file_create_url() and can be resolved by wrapping that in a call to file_url_transform_relative()
Patch attached which should resolve this

πŸ› Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States realgt

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany snitch182 Hannover

    thanks @reddyweb #5 worked for me

  • πŸ‡ΊπŸ‡¦Ukraine sickness29

    Rerolled for 2.0.0-alpha4

  • Status changed to Closed: outdated 11 months ago
  • πŸ‡¨πŸ‡¦Canada shaundychko

    After applying the patch here πŸ› Support h5p/h5p-core:1.26 and h5p/h5p-editor:1.25 Needs work , to use H5P 1.26 on the 2.0.x-dev version of this module, there doesn't seem to be an issue with serving over SSL. I also couldn't find any URL's starting with 'http://' hardcoded in the module folder. It doesn't seem like this patch is necessary any more.

  • πŸ‡³πŸ‡ΏNew Zealand lightweight

    Ok - after upgrading my D9 site to D10.2.6, I've run into the same problem with http:// being used for H5p javascript assets. The fix that worked for me is a modification of the above H5PDrupal.php_.patch updated via this: https://www.drupal.org/node/2940031 β†’

       -   return array_map(function($publicUrl){ return \Drupal::service('file_url_generator')->generateAbsoluteString($publicUrl); }, array_column($cachedAsset, 'data'));
       +  return array_map(function($publicUrl){ return \Drupal::service('file_url_generator')->generateString($publicUrl); }, array_column($cachedAsset, 'data'));
    

    It just involves removing the 'Absolute' from generateAbsoluteString.

Production build 0.71.5 2024