fix!: Only use webserver_port in developer mode (#26268)

This commit is contained in:
Ankush Menat 2024-05-01 12:11:01 +05:30 committed by GitHub
parent 72b1db0ae5
commit ee64b2cb6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 5 deletions

View file

@ -1331,7 +1331,10 @@ def start_ngrok(context, bind_tls, use_default_authtoken):
ngrok.set_auth_token(ngrok_authtoken)
port = frappe.conf.http_port or frappe.conf.webserver_port
port = frappe.conf.http_port
if not port and frappe.conf.developer_mode:
port = frappe.conf.webserver_port
tunnel = ngrok.connect(addr=str(port), host_header=site, bind_tls=bind_tls)
print(f"Public URL: {tunnel.public_url}")
print("Inspect logs at http://127.0.0.1:4040")

View file

@ -1777,9 +1777,12 @@ def get_url(uri: str | None = None, full_address: bool = False) -> str:
if not uri and full_address:
uri = frappe.get_request_header("REQUEST_URI", "")
port = frappe.conf.http_port or frappe.conf.webserver_port
port = frappe.conf.http_port
if not port and frappe.conf.developer_mode:
port = frappe.conf.webserver_port
if (
# XXX: This config is used as proxy for "is production mode enabled?"
not frappe.conf.restart_supervisor_on_update
and not frappe.conf.restart_systemd_on_update
and host_name

View file

@ -8,9 +8,7 @@ function get_url(socket, path) {
let url = socket.request.headers.origin;
if (conf.developer_mode) {
let [protocol, host, port] = url.split(":");
if (port != conf.webserver_port) {
port = conf.webserver_port;
}
url = `${protocol}:${host}:${port}`;
}
return url + path;