-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Unable to override basePath
in next.config.js
to allow running multiple Reflex apps on the same domain because of how Next.js serves /_next
.
#1633
Comments
/_next
.
/_next
.next.config.js
to allow running multiple reflex apps on the same domain because of how Next.js serves /_next
.
next.config.js
to allow running multiple reflex apps on the same domain because of how Next.js serves /_next
.basePath
in next.config.js
to allow running multiple reflex apps on the same domain because of how Next.js serves /_next
.
basePath
in next.config.js
to allow running multiple reflex apps on the same domain because of how Next.js serves /_next
.basePath
in next.config.js
to allow running multiple Reflex apps on the same domain because of how Next.js serves /_next
.
Thanks for the detailed writeup, your request is very clear. The team has purposefully restricted exposing the That said, this request seems quite reasonable, and not too hard to implement with the current code base. I think having a Is this something you'd be interested in contributing? I marked it as "good first issue" because it sounds relatively straightforward. |
Thanks @masenf. I'm loving Reflex, so yes I'd like to. 👍 |
@nevdelap i assigned the issue to you. let me know if you need any assistance or advice. |
- Tests. - And sorted config in next.config.js template.
That commit is working locally and has tests. I've not deployed it side by side with another app with Nginx on a real domain yet, but I'm expecting it to work. |
I like the approach. Thanks for making the separate function, cleaning up the logic, and adding test cases; very nice. |
I've deployed it on a real domain. Just had to change...
to
and it worked, then created a testapp with with just a It still says |
Hi there. I've been using this for several apps running on my domain since then (they are all behind basicauth) and it is working perfectly. Are there any other things you can think of that I should test, or are there any places this should be mentioned in docos before I do a pull request? The only thing I've got in my list is to check that it can be overridden from the environment without adding anything extra. Update: I checked overriding using FRONTEND_PATH env var. |
I was thinking once it is out I'd post something in Discord #deployment. |
…eflex apps off the same domain, and 1583 Show the correct info on where the site is being served. (#1724) * Support setting Next.js basePath in Reflex config. (#1633) - Tests. - And sorted config in next.config.js template. * Display the correct running at url with basePath if it is set. (#1583) * Formatting, fixed by black. * Fix indenting in test data. * Fixed that conflict resolution shouldnt have included console.debug line. * Rmove use of :=. Add http:// to url. Use urljoin to build url.
Describe the bug
reflex/utils/prerequisites.py
can changecompress
totrue
orfalse
based onnext_compression
inrxconfig.js
.next.config.js
is in.web
is in constants that as far as I can tell cannot be overridden.reflex init
, addbasePath: "chat",
to the.web/next.config.js
that it created, and runreflex run
it will run the site on a different path, e.g./chat
instead of/
, in dev mode, including/chat/_next
instead of/_next
. This is good.reflex run --env prod
it works too. This is good.So what I want to suggest is the issue is that what I've done in those two last points is a workaround that with a couple of lines of code in
prerequisites.py
could be a supported feature.Note: The reason this is needed is to change where Next.js serves
/_next
. The front-end and back-end can be served on whatever path you like on the domain (e.g. with Nginxproxy_pass
), but it is/_next
that is preventing running multiple sites on the same domain, as far as I've been able to figure out, because each app will have its own/_next
that cannot both be served on that same path publicly.(I'm new to Reflex and know nothing about Next.js other than what I've been investigating today, so maybe there's a better way that is already supported that I've not found.)
To Reproduce
As above.
Expected behavior
If
prerequisites.py
supported updatingbasePath
like it updatescompress
based onrxconfig.js
havingnext_compression = "true/false"
, by havingnext_base_path
, changing the Next.jsbasePath
would work out of the box to allow running multiple Reflex apps on the same domain with a one line addition torxconfig.js
in each app likenext_base_path = "/chat",
andnext_base_path = "/someotherapp",
It would want to do one other thing. When it reports
App running at: http://localhost:80
it would need to reportApp running at: http://localhost:80/chat
. That might just happen since that message is coming from Next.js, but I don't think it did. (It's midnight as I write this and I need to go to bed. I'll update this when I've checked.)Screenshots
N/A
Specifics (please complete the following information):
Additional context
N/A
Thanks. 🙏
The text was updated successfully, but these errors were encountered: