Skip to content

Fix: include relative URL root in PDF worker and cMap paths

What does this MR do and why?

Ensures PDF.js worker and character map files are loaded correctly when GitLab is installed with a relative URL root.

References

Screenshots or screen recordings

Before After
CleanShot 2025-07-24 at 12.32.08.png CleanShot 2025-07-24 at 12.34.54.png

How to set up and validate locally

  1. add a relative_url_root to gdk.yml (https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/configuration.md#notable-settings)
  2. visit your gdk at the updated root. for example:
    1. before this change, my gdk runs at https://gdk.test:3443.

    2. i added

      relative_url_root: /chao
    3. after gdk reconfigure, my gdk runs at https://gdk.test:3443/chao

    4. note, because of #547602 (comment 2609427520), routing will break so you will need to add your relative url to the url manually 🌚

  3. open a pdf (e.g. my fav https://wildwelfare.org/wp-content/uploads/Care-for-us-Capybara-1.pdf)
  4. file should load with no errors

MR acceptance checklist

1Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #381693 (closed)

Edited by Chaoyue Zhao

Merge request reports

Loading