Skip to content

[Feat] - Client appliaction routes constructed considering the BASE_URL #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

nachogrj
Copy link

Proposed changes

We wanted to publish the app through a reverse proxy and changing the configuration variables (both when using the already built docker image or building the code ourselves) wasn't taking effect. We detected that the BASE_URL wasn't being used when defining the rest of the routes, nor for the bundleLoader URL.

Types of changes

What types of changes does your code introduce to Lowcoder?
Put an x in the boxes that apply.

  • [ X] Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help!
This is simply a reminder of what we are going to look for before merging your code.
Put an x in the boxes that apply.

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc.

Copy link

netlify bot commented Jun 18, 2024

👷 Deploy request for lowcoder-cloud pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 489ab12

Ignacio Gómez-Rico Junquero added 2 commits June 19, 2024 09:46
…der to avoid possible "//" when building the rest of the routes
… app. Fixxed the conditional assignation of APP_ROOT
@nachogrj nachogrj changed the base branch from main to dev June 19, 2024 07:56
@FalkWolsky
Copy link
Contributor

Hello @nachogrj - you will smile, cause in the branch https://github.com/lowcoder-org/lowcoder/tree/feature-sub-path - we tried pretty much exactly this. We need to check the solution for the plugin loader. It could have cross effects.

Question... How about we join forces - and wor together in the feature-sub-path about this topic?

@nachogrj
Copy link
Author

Sure @FalkWolsky, the only thing is that I don't see how these changes may affect the plugin loader since the actual routes for routing requests (and loading files) are handled in the Nginx configuration (I am not familiar with how this backend works).

@FalkWolsky
Copy link
Contributor

Let us ask a small thing... By introducing the BASE_URL - what is the actual goal behind?
We do - which is the reason we ask - have a very old ticket and need to run lowcoder as subpath.
So not app.yoururl.com but yoururl.com/lowcoder/...

But this is tricky... Cause BASE_URL would be only used at Build time. Also, static resources are not affected by it. This counts for libraries (js), images and CSS.

Is "subpath" the goal of your PR?

@ludomikula
Copy link
Collaborator

As Falk mentioned, adding BASE_URL into the code is not enough in our case. The code is compiled into static files, so once it is generated, the variable will not help you, because all links in html/css/js will be generated with whatever it was set to during compile time.

@nachogrj
Copy link
Author

@FalkWolsky Yes, our intention is to publish the app (as a sub-path) using a reverse proxy. @ludomikula yes I'm awared of it, would it be possible to do it by injecting the configuration through an ".env" (when building the Dockerfile or running the docker-compose) file and checking the values from the application using "window.env.BASE_URL" at runtime (or something similar). Does it seem feasible?

@ludomikula
Copy link
Collaborator

Building the frontend image on startup would take really long time. It's quite a heavy process. What might be doable, is to generate a placeholder in the static files, something like LOWCODER_BASE_URL which then we could rewrite in nginx to the configured value.

@nachogrj
Copy link
Author

@ludomikula Sorry maybe I didn't express myself correctly, I said building the docker image but I was referring exclusively to its execution (running the container). I was thinking of getting the value of the environment variable at runtime, not at build time. Anyway, the problem we run into is the navigation from the client application, for which, the URLs do not contain the prefix that would allow us to distinguish for which application exactly I have to rewrite the URL (I'm thinking of a reverse proxy in front of multiple applications, not just the lowcoder ecosystem). Maybe the only way is to add a fixed block in the URL to be able to detect that a rewrite is to be performed. Is that what you meant?

@ludomikula
Copy link
Collaborator

@nachogrj yes, that's what I meant. Currently am not aware of another solution.

@ludomikula ludomikula force-pushed the dev branch 13 times, most recently from b319e9c to 7a26dc6 Compare September 3, 2024 17:12
@FalkWolsky FalkWolsky changed the title [Fix] - Client appliaction routes constructed considering the BASE_URL [Feat] - Client appliaction routes constructed considering the BASE_URL Jan 13, 2025
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.

3 participants