diff --git a/web/ProxiesBlock.tsx b/web/ProxiesBlock.tsx index 7677813..af32f9d 100644 --- a/web/ProxiesBlock.tsx +++ b/web/ProxiesBlock.tsx @@ -1,5 +1,5 @@ import { useCallback, useEffect, useRef, useState } from 'react'; -import { CircleDot, Globe, Loader2, Lock, Plus, ShieldCheck } from 'lucide-react'; +import { CircleDot, Gauge, Globe, Loader2, Lock, Plus, ShieldCheck } from 'lucide-react'; import { useClient } from 'hooks/useClient'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; @@ -46,6 +46,7 @@ type Host = { enabled: boolean; ssl_forced: boolean; certificate_id: number; + http2_support: boolean; meta?: { nginx_online?: boolean }; }; @@ -191,6 +192,33 @@ export const ProxiesBlock = ({ servers }: { servers: Server[] }) => { }); }; + /** + * Turn HTTP/2 on for a host that predates it being the default. + * + * Offered rather than done on load, even though it is one field and always the right answer: a + * panel that silently rewrites the proxy while you are reading it is not something to build, and + * the change momentarily reloads nginx for every site behind it. + * + * Only shown for a host that HAS a certificate — HTTP/2 is negotiated during the TLS handshake, so + * on a plain host the setting is stored and never used, and offering it there would be offering a + * button that does nothing visible. + */ + const upgrade = async (host: Host) => { + setBusy(`http2:${host.id}`); + setFailed(false); + setOutput(null); + try { + await clientRef.current.put(`/proxy-manager/npm/nginx/proxy-hosts/${host.id}`, { http2_support: true }); + setOutput(`${host.domain_names.join(', ')} → HTTP/2`); + await load(); + } catch (failure) { + setOutput(readableError(failure)); + setFailed(true); + } finally { + setBusy(null); + } + }; + const secure = async (host: Host) => { const names = host.domain_names; setBusy(`cert:${host.id}`); @@ -320,6 +348,21 @@ export const ProxiesBlock = ({ servers }: { servers: Server[] }) => { )}
+ {/* + Only when it is both possible and missing. A host created since http2_support became the + default never shows this, which is the point — it is a repair, not a setting. + */} + {host.certificate_id > 0 && !host.http2_support && ( + + )} + {!host.certificate_id && (