Skip to content

[AFBH-1740] : Normalize public URL handling in dev server#951

Open
SravanKumar2305 wants to merge 1 commit intoatlassian-labs:mainfrom
SravanKumar2305:fix/AFBH-1740
Open

[AFBH-1740] : Normalize public URL handling in dev server#951
SravanKumar2305 wants to merge 1 commit intoatlassian-labs:mainfrom
SravanKumar2305:fix/AFBH-1740

Conversation

@SravanKumar2305
Copy link
Copy Markdown

Motivation

The dev server currently allows publicUrl values without trailing slashes (e.g., http://localhost:8080 or /assets), which can result in malformed asset URLs like localhost:8080assets.json instead of localhost:8080/assets.json. This leads to broken asset loading in the development environment.

Changes

  • Added URL normalization that affects both dev server routing and bundled asset URLs
  • Added a new feature flag normalizePublicUrlTrailingSlash that automatically appends a trailing slash to publicUrl values in the dev server when enabled
  • The feature flag is enabled by default in test environment but disabled in production to maintain backward compatibility
  • Added integration tests to verify the normalization works correctly for both relative paths (e.g., /assets) and full URLs (e.g., http://localhost:8080)
  • Updated both packages/core/cli/src/normalizeOptions.ts and packages/core/feature-flags/src/index.ts

Checklist

  • Existing or new tests cover this change
  • There is a changeset for this change, or one is not required

Changeset :

This change adds a new feature flag normalizePublicUrlTrailingSlash that, when enabled, automatically adds a trailing slash to publicUrl values in the dev server. This prevents issues where URLs without trailing slashes (e.g., http://localhost:8080 or /assets) could result in malformed asset URLs like localhost:8080assets.json instead of localhost:8080/assets.json.

The feature flag is disabled by default to maintain backward compatibility. Enable it with:

featureFlags: {
  normalizePublicUrlTrailingSlash: true;
}

@SravanKumar2305 SravanKumar2305 requested a review from a team as a code owner January 8, 2026 10:49
@atlassian-cla-bot
Copy link
Copy Markdown

Thank you for your submission! Like many open source projects, we ask that you sign our CLA (Contributor License Agreement) before we can accept your contribution.
If your email is listed below, please ensure that you sign the CLA with the same email address.

The following users still need to sign our CLA:
❌SravanKumar2305

Already signed the CLA? To re-check, try refreshing the page.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 8, 2026

🦋 Changeset detected

Latest commit: 81cc853

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 112 packages
Name Type
@atlaspack/cli Patch
@atlaspack/feature-flags Patch
@atlaspack/integration-tests Patch
atlaspack Patch
@atlaspack/inspector Patch
@atlaspack/inspector-frontend Patch
@atlaspack/bundler-experimental Patch
@atlaspack/bundler-default Patch
@atlaspack/cache Patch
@atlaspack/core Patch
@atlaspack/fs Patch
@atlaspack/graph Patch
@atlaspack/types-internal Patch
@atlaspack/utils Patch
@atlaspack/optimizer-inline-requires Patch
@atlaspack/packager-html Patch
@atlaspack/packager-js Patch
@atlaspack/reporter-cli Patch
@atlaspack/reporter-compiled-css-in-js-migration-map Patch
@atlaspack/reporter-conditional-manifest Patch
@atlaspack/runtime-js Patch
@atlaspack/runtime-react-refresh Patch
@atlaspack/transformer-compiled-css-in-js Patch
@atlaspack/transformer-css Patch
@atlaspack/transformer-html Patch
@atlaspack/transformer-js Patch
@atlaspack/transformer-react-refresh-wrap Patch
@atlaspack/transformer-tokens Patch
@atlaspack/node-resolver-core Patch
@atlaspack/config-default Patch
@atlaspack/test-utils Patch
@atlaspack/query Patch
@atlaspack/config-webextension Patch
@atlaspack/register Patch
@atlaspack/bundle-stats Patch
@atlaspack/optimizer-image Patch
@atlaspack/reporter-bundle-stats Patch
@atlaspack/transformer-image Patch
@atlaspack/package-manager Patch
@atlaspack/link Patch
@atlaspack/codeframe Patch
@atlaspack/logger Patch
@atlaspack/plugin Patch
@atlaspack/profiler Patch
@atlaspack/types Patch
@atlaspack/workers Patch
@atlaspack/packager-css Patch
@atlaspack/reporter-bundle-buddy Patch
@atlaspack/resolver-tesseract Patch
@atlaspack/transformer-less Patch
@atlaspack/transformer-postcss Patch
@atlaspack/transformer-xml Patch
@atlaspack/ts-utils Patch
@atlaspack/optimizer-blob-url Patch
@atlaspack/optimizer-css Patch
@atlaspack/optimizer-data-url Patch
@atlaspack/optimizer-svgo Patch
@atlaspack/optimizer-swc Patch
@atlaspack/optimizer-terser Patch
@atlaspack/packager-raw-url Patch
@atlaspack/packager-svg Patch
@atlaspack/packager-webextension Patch
@atlaspack/packager-xml Patch
@atlaspack/reporter-build-metrics Patch
@atlaspack/reporter-bundle-analyzer Patch
@atlaspack/reporter-dev-server-sw Patch
@atlaspack/reporter-dev-server Patch
@atlaspack/reporter-json Patch
@atlaspack/reporter-lsp Patch
@atlaspack/reporter-sourcemap-visualiser Patch
@atlaspack/reporter-tracer Patch
@atlaspack/resolver-glob Patch
@atlaspack/runtime-browser-hmr Patch
@atlaspack/runtime-service-worker Patch
@atlaspack/runtime-webextension Patch
@atlaspack/transformer-babel Patch
@atlaspack/transformer-compiled Patch
@atlaspack/transformer-posthtml Patch
@atlaspack/transformer-typescript-types Patch
@atlaspack/transformer-webextension Patch
@atlaspack/transformer-webmanifest Patch
@atlaspack/watcher-watchman-js Patch
@atlaspack/validator-eslint Patch
@atlaspack/validator-typescript Patch
@atlaspack/resolver-default Patch
@atlaspack/bundler-library Patch
@atlaspack/compressor-brotli Patch
@atlaspack/compressor-gzip Patch
@atlaspack/compressor-raw Patch
@atlaspack/namer-default Patch
@atlaspack/optimizer-cssnano Patch
@atlaspack/optimizer-htmlnano Patch
@atlaspack/packager-raw Patch
@atlaspack/packager-ts Patch
@atlaspack/packager-wasm Patch
@atlaspack/transformer-compiled-external Patch
@atlaspack/transformer-glsl Patch
@atlaspack/transformer-graphql Patch
@atlaspack/transformer-inline-string Patch
@atlaspack/transformer-inline Patch
@atlaspack/transformer-json Patch
@atlaspack/transformer-jsonld Patch
@atlaspack/transformer-mdx Patch
@atlaspack/transformer-pug Patch
@atlaspack/transformer-raw Patch
@atlaspack/transformer-sass Patch
@atlaspack/transformer-svg-react Patch
@atlaspack/transformer-svg Patch
@atlaspack/transformer-toml Patch
@atlaspack/transformer-typescript-tsc Patch
@atlaspack/transformer-worklet Patch
@atlaspack/transformer-yaml Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

@marcins marcins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in Slack - my main concern is that there might intentionally be a base URL without a trailing slash somewhere, but this is less likely for our internal use case (FWIW Webpack/rspack for example don't append a / - I've fallen for that before!).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants