Skip to content

@W-20784722@ Move envBasePath into ssrParameters#3590

Merged
vcua-mobify merged 8 commits intofeature/productize-path-prefixesfrom
path-prefix-in-ssrParameters
Jan 23, 2026
Merged

@W-20784722@ Move envBasePath into ssrParameters#3590
vcua-mobify merged 8 commits intofeature/productize-path-prefixesfrom
path-prefix-in-ssrParameters

Conversation

@vcua-mobify
Copy link
Contributor

@vcua-mobify vcua-mobify commented Jan 21, 2026

This PR moves the experimental envBasePath property from the config root into ssrParameters.

This change allows us to send envBasePath to MRT as part of ssrParameters, thereby allowing MRT to consume and handle this path prefix.

This PR also updates existing files so that on both local and remote MRT environments:

  • The server obtains the envBasePath from the MRT_ENV_BASE_PATH system environment variable in node
  • The client app obtains the envBasePath from window
  • window.MRT_ENV_BASE_PATH is set on app render
  • The local dev server sets config.ssrParameters.envBasePath into process.env.MRT_ENV_BASE_PATH
  • Updates our local validation of envBasePath to match MRT restrictions (we no longer allow multi-part base paths like /path1/path2/path3)

Additionally, this PR updates the default config + generator config templates.

Testing the changes:

In your config file, set envBasePath to something like '/shop' or '/us' or '/test'
Start the app
Verify that all express routes (ie. calls to /mobify/proxy or /mobify/bundle or /callback) use the envBasePath you have set
You can also check that window.MRT_ENV_BASE_PATH is set to what you have in the config file

Try setting an invalid base path. You should see an error on app start.

Starting the app without a base path works as normal.

@vcua-mobify vcua-mobify requested a review from a team as a code owner January 21, 2026 01:18
@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Jan 21, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@vcua-mobify vcua-mobify requested a review from noahadams January 21, 2026 22:32

// Load config to get envBasePath for local development
const config = getConfig() || {}
const envBasePath = config.ssrParameters?.envBasePath || ''
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a comment describing why we need to read from ssrParameters only for local development

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment added

Copy link
Contributor

@unandyala unandyala left a comment

Choose a reason for hiding this comment

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

Left couple of comments. overall LGTM

apiKey: process.env.GOOGLE_CLOUD_API_KEY
}
},
envBasePath: '/',
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the same default value in ssrParameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. The default value is for the envBasePath to be undefined so that it is not set on MRT or local.

Once it is defined, it must be a valid value (ie. /shop). The changes in this PR disallow setting envBasePath to just /

@vcua-mobify vcua-mobify merged commit 2c250bd into feature/productize-path-prefixes Jan 23, 2026
42 checks passed
@vcua-mobify vcua-mobify deleted the path-prefix-in-ssrParameters branch January 23, 2026 19:24
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.

4 participants