Skip to content

Commit df5c585

Browse files
authored
Fix proxy HTTPS address comparison missing replace argument (#4511)
`address.replace('http')` without a second argument replaces "http" with the string "undefined" in JavaScript, causing `isCurrentAddress()` to always return false when using an HTTPS reverse proxy in front of Plan's HTTP server. This breaks subpath routing — the React app falls back to an empty `baseAddress`, so the router has no basename and API calls go to relative paths instead of the configured address. Adding the missing empty string argument (`address.replace('http', '')`) correctly strips the protocol for comparison.
1 parent eb96177 commit df5c585

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Plan/react/dashboard/src/service/backendConfiguration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const isCurrentAddress = (address) => {
1010
let is = window.location.href.startsWith(address);
1111
const usingProxyHttps = window.location.href.startsWith("https") && !address.startsWith("https");
1212
if (usingProxyHttps) {
13-
is = window.location.href.replace('https', '').startsWith(address.replace('http'));
13+
is = window.location.href.replace('https', '').startsWith(address.replace('http', ''));
1414
}
1515
if (!is) {
1616
console.warn(`Configured address ${address} did not match start of ${window.location.href}, falling back to relative address. Configure 'Webserver.Alternative_IP' settings to point to your address.`)

0 commit comments

Comments
 (0)