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.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | garden_gnome_package-relative-urls-3629309-4.patch | 1.6 KB | dejan0 |
Comments
Comment #2
dejan0 commentedComment #3
dejan0 commentedComment #4
dejan0 commentedplease find the patch attached
Comment #5
grienauerComment #7
cezara commentedCommitted to 1.0.x, thank you!