fix: admin/options: proxy warning when it shouldn't #990
Massimo Melina committed
May 8, 2025 at 14:12 UTC
97f6b1ed19c691473478486d650355f737617755
2 files changed
+3
-3
admin/src/HomePage.ts
+1
-1
@@ -102,7 +102,7 @@ export default function HomePage() {
102
status.frpDetected && entry('warning', `FRP is detected. It should not be used with "type = tcp" with HFS. Possible solutions are`,
103
h('ol',{},
104
h('li',{}, `configure FRP with type=http (best solution)`),
105
- h('li',{}, md(`configure FRP to connect to HFS <u>not</u> with 127.0.0.1 (safe, but you won't see users' IPs)`)),
105
+ h('li',{}, md(`configure FRP to connect to HFS <u>not</u> with localhost (safe, but you won't see users' IPs)`)),
106
h('li',{}, `disable "admin access for localhost" in HFS (safe, but you won't see users' IPs)`),
107
)),
108
entry('', wikiLink('', "See the documentation"), " and ", h(Link, { target: 'support', href: REPO_URL + 'discussions' }, "get support")),
src/middlewares.ts
+2
-2
@@ -65,7 +65,7 @@ export const someSecurity: Koa.Middleware = (ctx, next) => {
65
if (!ctx.state.skipFilters && applyBlock(ctx.socket, ctx.ip))
66
return
67
68
- if (!ctx.ips.length && ctx.get('X-Forwarded-For') // empty ctx.ips implies we didn't configure for proxies
68
+ if (ctx.get('X-Forwarded-For')
69
// we have some dev-proxies to ignore
70
&& !(DEV && [process.env.FRONTEND_PROXY, process.env.ADMIN_PROXY].includes(ctx.get('X-Forwarded-port')))) {
71
proxyDetected = ctx
@@ -89,7 +89,7 @@ export const someSecurity: Koa.Middleware = (ctx, next) => {
89
90
// limited to http proxies
91
export function getProxyDetected() {
92
- if (proxyDetected?.state.whenProxyDetected < Date.now() - DAY)
92
+ if (proxyDetected?.state.whenProxyDetected < Date.now() - DAY) // detection is reset after a day
93
proxyDetected = undefined
94
return proxyDetected && { from: proxyDetected.ip, for: proxyDetected.get('X-Forwarded-For') }
95
}