Problem/Motivation

GGPackage::__construct() builds public_url and package_url with StreamWrapperInterface::getExternalUrl(). That returns an absolute URL with the host of the current request. These URLs end up in the rendered markup: player/skin 'script src', preview image, and readConfigUrlAsync().

The formatter adds no url.site cache context, so the render cache serves markup built for one host on all hosts. Setup where this breaks:

- Drupal runs on origin.example.com (basic auth) behind a CDN or reverse proxy on www.example.com.
- If a page is first rendered via the origin host, visitors on www get scripts from origin.example.com and see a basic auth prompt. The panorama does not load.

FileUrlGeneratorInterface recommends relative URLs unless an absolute one is required.

Steps to reproduce

1. Serve the same site on two hostnames.
2. Visit a page with a package on host A, then the same page on host B.
3. Asset URLs on host B point to host A.

Proposed resolution

Pass both URLs through file_url_generator->transformRelative(). The markup no longer depends on the host, so no extra cache context is needed.

Comments

dejan0 created an issue. See original summary.

dejan0’s picture

Issue summary: View changes
dejan0’s picture

Issue summary: View changes
dejan0’s picture

Status: Active » Needs review
StatusFileSize
new1.6 KB

please find the patch attached

grienauer’s picture

Assigned: Unassigned » cezara
Status: Needs review » Reviewed & tested by the community

  • cezara committed ee5e06d0 on 1.0.x
    Issue #3629309 by dejan0, grienauer, cezara: Package asset URLs are...
cezara’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 1.0.x, thank you!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.