fix: admin/internet: "Accept requests only using domain" was not working
Massimo Melina committed
Dec 23, 2023 at 19:42 UTC
224eb23ccff3cf2ab645416b16480240acdb2eeb
2 files changed
+2
-2
src/listen.ts
+1
-1
@@ -25,7 +25,7 @@ let httpsSrv: undefined | http.Server & ServerExtra
25
const openBrowserAtStart = defineConfig('open_browser_at_start', !DEV)
26
27
export const baseUrl = defineConfig('base_url', '',
28
- x => /\/\/[^\/]+/.exec(x)?.[1]) // compiled is host only
28
+ x => /(?<=\/\/)[^\/]+/.exec(x)?.[0]) // compiled is host only
29
30
export function getBaseUrlOrDefault() {
31
return baseUrl.get() || defaultBaseUrl.get()
src/middlewares.ts
+1
-1
@@ -198,7 +198,7 @@ export const someSecurity: Koa.Middleware = async (ctx, next) => {
198
catch {
199
return ctx.status = HTTP_FOOL
200
}
201
- if (forceBaseUrl.get() && !isLocalHost(ctx) && ctx.host === baseUrl.compiled())
201
+ if (forceBaseUrl.get() && !isLocalHost(ctx) && ctx.host !== baseUrl.compiled())
202
return disconnect(ctx)
203
return next()
204
}