fix(webui): read REST API URL at runtime instead of build time - #585
Merged
Merged
Conversation
The API URL was inlined into the JS bundle by Vue CLI, so a published image only ever worked against whatever host it was built for. Serve the value from config.js instead, regenerated at container start from OPENAS2_RESTAPI_URL (default http://localhost:8443/api) by a script in nginx's /docker-entrypoint.d. One image now serves any deployment. The build-time VUE_APP_RESTAPI_URL still works as a fallback, so existing builds are unaffected.
GreicodexJM
force-pushed
the
fix/webui-runtime-restapi-url
branch
from
August 7, 2026 14:16
860f711 to
d14a57a
Compare
uhurusurfa
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
VUE_APP_RESTAPI_URLis read viaprocess.envinLoginScreen.vue, which Vue CLIinlines as a string literal at compile time. The REST API URL is therefore baked
into the JS bundle when the image is built.
The practical effect is that a published
Dockerfile_WebUIimage only ever worksagainst whatever host it was built for. It defaults to
http://localhost:8080, soanyone pulling a prebuilt WebUI image has to rebuild it from source just to point
the UI at their own server. That makes the WebUI image hard to distribute.
Change
Serve the value from a small
config.jsloaded before the app bundle, andregenerate that file at container start from an environment variable.
WebUI/public/config.js— setswindow.__OPENAS2_CONFIG__WebUI/docker/40-openas2-config.sh— rewrites it fromOPENAS2_RESTAPI_URL.Dropped into
/docker-entrypoint.d/, which the official nginx image alreadysources, so no
ENTRYPOINToverride is needed.LoginScreen.vue— resolution order: runtime config → build-timeVUE_APP_RESTAPI_URL→http://127.0.0.1:8443/apidocker-compose.yml— buildargsbecome runtimeenvironmentDefault is
http://localhost:8443/api, matching the compose REST API port.Backwards compatible. The build arg still works and still wins over the
compiled default, so existing build pipelines are unaffected. The only behaviour
change is that
OPENAS2_RESTAPI_URL, when set, takes precedence.Verification
Built the image and ran it both ways:
Also confirmed
__OPENAS2_CONFIG__is present in both the modern and legacycompiled bundles, so the app actually reads it rather than the file merely being
served.
The change was additionally applied across the v4.1.0–v4.9.0 tags and built for
each; the anchors it touches are unchanged across that range.
Note
The URL is interpolated into a JS string literal, so the entrypoint escapes
backslashes and double quotes. It is an operator-supplied value, not user input.