fix: admin/internet: must not use only-domain option if no domain is specified #480
Massimo Melina committed
Feb 17, 2024 at 17:05 UTC
9d1b36b35c225b3144f8e2ec534df880f43f9361
2 files changed
+5
-2
admin/src/InternetPage.ts
+4
-1
@@ -253,7 +253,10 @@ export default function InternetPage() {
253
saveOnChange: true,
254
form: {
255
fields: [
256
- { k: 'force_base_url', comp: BoolField, label: "Accept requests only using domain (and localhost)" }
256
+ { k: 'force_base_url', comp: BoolField, disabled: !url,
257
+ label: "Accept requests only using domain (and localhost)",
258
+ helperText: !url && "You must specify an address, for this option"
259
+ }
260
]
261
},
262
})
src/middlewares.ts
+1
-1
@@ -76,7 +76,7 @@ export const someSecurity: Koa.Middleware = async (ctx, next) => {
76
catch {
77
return ctx.status = HTTP_FOOL
78
}
79
- if (!ctx.state.skipFilters && forceBaseUrl.get() && !isLocalHost(ctx) && ctx.host !== baseUrl.compiled())
79
+ if (!ctx.state.skipFilters && forceBaseUrl.get() && baseUrl.compiled() && !isLocalHost(ctx) && ctx.host !== baseUrl.compiled())
80
return disconnect(ctx, 'force-domain')
81
if (!ctx.secure && forceHttps.get() && getHttpsWorkingPort() && !isLocalHost(ctx)) {
82
const { URL } = ctx