Support for Subpath Hosting (Reverse Proxy under a subdirectory)
I am attempting to integrate Twenty CRM into a custom multi-tenant infrastructure where creating unique subdomains for every instance is not feasible due to cost and management complexity.
I need to host Twenty CRM behind a reverse proxy using a subpath structure.
- Current: The app expects to be at https://crm.mydomain.xx/
- Required: The app needs to load at https://mydomain.xx/customerA/env/crm
Current Behavior When configuring the reverse proxy to serve Twenty on a subpath, the application fails to load correctly.
1. The frontend application appears to use hardcoded navigation and asset loading using absolute paths from the root (e.g., /index.html or /_next/...).
2. It ignores the Server URL configuration regarding the path prefix.
3. Attempting to inject prefixes into index.html fails because the Next.js runtime dynamically loads content using absolute paths.
I would expect the application to respond to a base path that also include a subdirectory like /path/to/root.
Willingness to contribute: I am available to work on a Pull Request to implement this flexibility, but I need guidance on whether this fits the current roadmap or if there are specific configuration files I should target first.
4 Replies
@Marco Morozzi could you tell me what env variable you have set and with what value so we can reproduce?
I think your description is right but I want to make sure not to do dig in a bad direction
(you can give me fake values of course)
FRONTEND_URL?
(note that we don't use NextJS 😉 )
(note that we don't use NextJS 😉) Oh ok thank you for clarifying. I just did a fast lookup in the code, and just assumed...
I did not specify env variable: FRONTEND_URL
i just did specify: SERVER_URL=http://my-domain/customer/crm
and added this headers to my custom proxy.
r.Header.Set("X-Forwarded-For", r.RemoteAddr) // user addr
r.Header.Set("X-Forwarded-Host", r.Host) // this contains mydomain.xx
r.Header.Set("X-Forwarded-Proto", "https")
r.Header.Set("X-Forwarded-Port", "443")
I'm using default twenty docker compose script fotr the moment
@Marco Morozzi I see, there is another env variable called FRONTEND_URL, could you try to play with it and see if it works?
no front end url do not wokrs...