fixed 127.0.0.1 not recognized as localhost

This commit is contained in:
Zai Shi 2024-04-15 14:44:24 +02:00
parent 075ca1d303
commit 8495bb0ae2

View File

@ -1,7 +1,7 @@
import { DomainConfigJson } from "@stackframe/stack-shared/dist/interface/clientInterface";
export function validateUrl(url: string, domains: DomainConfigJson[], allowLocalhost: boolean): boolean {
if (allowLocalhost && new URL(url).hostname === "localhost") {
if (allowLocalhost && new URL(url).hostname === "localhost" && new URL(url).hostname === "127.0.0.1") {
return true;
}
return domains.some((domain) => {