Skip to content
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

--env prod reports App running at: http://localhost. #1583

Closed
nevdelap opened this issue Aug 14, 2023 · 1 comment
Closed

--env prod reports App running at: http://localhost. #1583

nevdelap opened this issue Aug 14, 2023 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@nevdelap
Copy link
Contributor

nevdelap commented Aug 14, 2023

Describe the bug

When running in prod mode it reports that it is running at http://localhost. It's a minor thing, but 0.0.0.0 is not localhost (127.0.0.1), it's bind to all addresses, and it sent me up the garden path debugging for a long time when I'd simply mistyped api_url as app_url in rxconfig.py. 😱

root@droplet:~/webchat/webui# reflex run --env prod --frontend-port 80
──────────────────────────────────────────────────────────────────────────────────────────────── Starting Reflex App ────────────────────────────────────────────────────────────────────────────────────────────────
Compiling:  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 1/1 0:00:00
Creating Production Build:  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 9/9 0:00:57
──────────────────────────────────────────────────────────────────────────────────────────────────── App Running ────────────────────────────────────────────────────────────────────────────────────────────────────
App running at: http://localhost:80
Compiling:  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 1/1 0:00:00

To Reproduce

As above, run with --env prod.

Expected behavior

App running at: http://0.0.0.0:80

Screenshots

N/A

Specifics (please complete the following information):

  • Python Version: 3.10.12
  • Reflex Version: 0.2.4
  • OS: Linux
  • Browser (Optional): N/A

Additional context

It looks like it is coming from from Next.js logging this: ready started server on 0.0.0.0:3000, url: http://localhost:3000. 0.0.0.0 is not localhost - 127.0.0.1 so it's misleading. Next.js (if that's what is reporting that line) is telling a porky.

exec.py parses that and reports the wrong info with these lines.

if "ready started server on" in line:
    url = line.split("url: ")[-1].strip()
    console.print(f"App running at: [bold green]{url}")

Thanks. 🙏

@nevdelap
Copy link
Contributor Author

Add a commit to fix this problem, and to make it show the basePath if set. Is on top of #1633.

masenf pushed a commit that referenced this issue Sep 2, 2023
…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.
@nevdelap nevdelap closed this as completed Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants