Skip to content

fix: send RUM beacons to codeBasePath-relative /.rum instead of root - #242

Merged
shsteimer merged 1 commit into
mainfrom
fix/rum-collect-basepath
Aug 26, 2026
Merged

fix: send RUM beacons to codeBasePath-relative /.rum instead of root#242
shsteimer merged 1 commit into
mainfrom
fix/rum-collect-basepath

Conversation

@shsteimer

Copy link
Copy Markdown
Contributor

What changed

sampleRUM.collectBaseURL in src/setup.js now resolves to origin + codeBasePath + '/' instead of bare window.origin, so rum-js's beacon URL (built as new URL('.rum/${weight}', collectBaseURL)) lands at /codebasepath/.rum/... for sites deployed under a subpath. Root-deployed sites are unaffected. Also removed the c8 ignore on init() and added a test covering the new collectBaseURL value.

Why

RUM requests were always sent to /.rum at the domain root, even when the site's code base lives under a subpath — breaking setups where .rum is only proxied under that subpath.

🤖 Generated with Claude Code

sampleRUM.collectBaseURL was set to bare window.origin, so rum-js
always resolved the beacon endpoint to /.rum at the domain root
regardless of where the site's code is deployed. Include
codeBasePath so sites served from a subpath get their RUM requests
routed to /codebasepath/.rum.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@shsteimer
shsteimer marked this pull request as ready for review August 25, 2026 15:49
@shsteimer
shsteimer merged commit e9e4786 into main Aug 26, 2026
4 checks passed
@shsteimer
shsteimer deleted the fix/rum-collect-basepath branch August 26, 2026 16:22
shsteimer added a commit that referenced this pull request Aug 27, 2026
dist/aem.js was stale relative to src changes in #205 and #242.

Co-Authored-By: Sean Steimer <ssteimer@adobe.com>
shsteimer added a commit that referenced this pull request Aug 27, 2026
* fix(test): update stale codeBasePath expectation in setup test

PR #205 changed codeBasePath derivation to import.meta.url but left one
assertion expecting the old DOM-based path.

Co-Authored-By: Sean Steimer <ssteimer@adobe.com>

* chore: rebuild dist

dist/aem.js was stale relative to src changes in #205 and #242.

Co-Authored-By: Sean Steimer <ssteimer@adobe.com>
trieloff pushed a commit that referenced this pull request Aug 27, 2026
## [3.1.8](v3.1.7...v3.1.8) (2026-08-27)

### Bug Fixes

* derive codeBasePath from import.meta.url instead of DOM query ([#205](#205)) ([af0d5c2](af0d5c2))
* send RUM beacons to codeBasePath-relative /.rum instead of root ([#242](#242)) ([e9e4786](e9e4786))
* update stale setup test and rebuild dist ([#243](#243)) ([34fb1f9](34fb1f9)), closes [#205](#205) [#205](#205) [#242](#242)
@trieloff

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.1.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants