Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6e021b6

Browse files
authored
chore: record and raise problematic http protocols for each proxy (#15917)
Adds warnings to the proxy and proxy health pages on HTTP 1.1, 1.0, 0.9protocols.Only the performance API can return the HTTP protocol type. We alreadyuse the performance API for latency timings, and each proxy could havethis issue.
1 parentf0e81ab commit6e021b6

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

‎site/src/contexts/useProxyLatency.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export interface ProxyLatencyReport {
1515
latencyMS:number;
1616
// at is when the latency was recorded.
1717
at:Date;
18+
/**
19+
* nextHopProtocol can determine if HTTP/2 is being used.
20+
* https://developer.mozilla.org/docs/Web/API/PerformanceResourceTiming/nextHopProtocol
21+
*/
22+
nextHopProtocol?:string;
1823
}
1924

2025
interfaceProxyLatencyAction{
@@ -151,6 +156,7 @@ export const useProxyLatency = (
151156
// https://developer.mozilla.org/en-US/docs/Web/API/Performance_API/Resource_timing
152157
letlatencyMS=0;
153158
letaccurate=false;
159+
letnextHopProtocol:string|undefined=undefined;
154160
if(
155161
"requestStart"inentry&&
156162
(entryasPerformanceResourceTiming).requestStart!==0
@@ -159,6 +165,7 @@ export const useProxyLatency = (
159165
consttimingEntry=entryasPerformanceResourceTiming;
160166
latencyMS=timingEntry.responseStart-timingEntry.requestStart;
161167
accurate=true;
168+
nextHopProtocol=timingEntry.nextHopProtocol;
162169
}else{
163170
// This is the total duration of the request and will be off by a good margin.
164171
// This is a fallback if the better timing is not available.
@@ -175,7 +182,8 @@ export const useProxyLatency = (
175182
latencyMS,
176183
accurate,
177184
at:newDate(),
178-
},
185+
nextHopProtocol:nextHopProtocol,
186+
}asProxyLatencyReport,
179187
};
180188
dispatchProxyLatencies(update);
181189
// Also save to local storage to persist the latency across page refreshes.

‎site/src/pages/UserSettingsPage/WorkspaceProxyPage/WorkspaceProxyRow.tsx‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,30 @@ export const ProxyRow: FC<ProxyRowProps> = ({ proxy, latency }) => {
2626
// All users can see healthy/unhealthy, some can see more.
2727
letstatusBadge=<ProxyStatusproxy={proxy}/>;
2828
letshouldShowMessages=false;
29+
constextraWarnings:string[]=[];
30+
if(latency?.nextHopProtocol){
31+
switch(latency.nextHopProtocol){
32+
case"http/0.9":
33+
case"http/1.0":
34+
case"http/1.1":
35+
extraWarnings.push(
36+
// biome-ignore lint/style/useTemplate: easier to read short lines
37+
`Requests to the proxy from current browser are using "${latency.nextHopProtocol}". `+
38+
"The proxy server might not support HTTP/2. "+
39+
"For usability reasons, HTTP/2 or above is recommended. "+
40+
"Pages may fail to load if the web browser's concurrent "+
41+
"connection limit per host is reached.",
42+
);
43+
}
44+
}
45+
2946
if("status"inproxy){
3047
constwsproxy=proxyasWorkspaceProxy;
3148
statusBadge=<DetailedProxyStatusproxy={wsproxy}/>;
3249
shouldShowMessages=Boolean(
3350
(wsproxy.status?.report?.warnings&&
3451
wsproxy.status?.report?.warnings.length>0)||
52+
extraWarnings.length>0||
3553
(wsproxy.status?.report?.errors&&
3654
wsproxy.status?.report?.errors.length>0),
3755
);
@@ -76,7 +94,10 @@ export const ProxyRow: FC<ProxyRowProps> = ({ proxy, latency }) => {
7694
colSpan={4}
7795
css={{padding:"0 !important",borderBottom:0}}
7896
>
79-
<ProxyMessagesRowproxy={proxyasWorkspaceProxy}/>
97+
<ProxyMessagesRow
98+
proxy={proxyasWorkspaceProxy}
99+
extraWarnings={extraWarnings}
100+
/>
80101
</TableCell>
81102
</TableRow>
82103
)}
@@ -86,9 +107,13 @@ export const ProxyRow: FC<ProxyRowProps> = ({ proxy, latency }) => {
86107

87108
interfaceProxyMessagesRowProps{
88109
proxy:WorkspaceProxy;
110+
extraWarnings:string[];
89111
}
90112

91-
constProxyMessagesRow:FC<ProxyMessagesRowProps>=({ proxy})=>{
113+
constProxyMessagesRow:FC<ProxyMessagesRowProps>=({
114+
proxy,
115+
extraWarnings,
116+
})=>{
92117
consttheme=useTheme();
93118

94119
return(
@@ -101,7 +126,7 @@ const ProxyMessagesRow: FC<ProxyMessagesRowProps> = ({ proxy }) => {
101126
title={
102127
<spancss={{color:theme.palette.warning.light}}>Warnings</span>
103128
}
104-
messages={proxy.status?.report?.warnings}
129+
messages={[...(proxy.status?.report?.warnings??[]), ...extraWarnings]}
105130
/>
106131
</>
107132
);

‎site/src/testHelpers/entities.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ export const MockProxyLatencies: Record<string, ProxyLatencyReport> = {
206206
100)%
207207
250,
208208
at:newDate(),
209+
nextHopProtocol:
210+
proxy.id==="8444931c-0247-4171-842a-569d9f9cbadb"
211+
?"http/1.1"
212+
:"h2",
209213
};
210214
returnacc;
211215
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp