Skip to content

Commit e7045a1

Browse files
committed
fix: ignore stale stored api url
1 parent 6602cd1 commit e7045a1

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

frontend/src/main.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ declare global {
2424
}
2525
}
2626

27-
// Check if we have an api url in local storage and use it if that's the case
27+
// Check if we have an api url in local storage and use it if the bundled
28+
// frontend did not provide one. This prevents stale values from another host
29+
// from overriding the same-origin default and causing CORS failures.
2830
const apiUrlFromStorage = localStorage.getItem('API_URL')
29-
if (apiUrlFromStorage !== null) {
31+
if (apiUrlFromStorage !== null && window.API_URL === '') {
3032
window.API_URL = apiUrlFromStorage
3133
}
3234

0 commit comments

Comments
 (0)