File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
tunnel/internal/client/ssh Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,29 @@ func (s *SshClient) httpTunnel(src, dst net.Conn) {
198
198
return
199
199
}
200
200
201
+ // Early return for health check requests with a direct response
202
+ if request .Header .Get ("X-Portr-Ping-Request" ) == "true" {
203
+ response := & http.Response {
204
+ Status : "200 OK" ,
205
+ StatusCode : 200 ,
206
+ Proto : "HTTP/1.1" ,
207
+ ProtoMajor : 1 ,
208
+ ProtoMinor : 1 ,
209
+ Header : http.Header {},
210
+ Body : io .NopCloser (bytes .NewBufferString ("" )),
211
+ }
212
+
213
+ err = response .Write (srcWriter )
214
+ if err != nil {
215
+ if s .config .Debug {
216
+ log .Error ("Failed to write health check response" , "error" , err )
217
+ }
218
+ return
219
+ }
220
+ srcWriter .Flush ()
221
+ return
222
+ }
223
+
201
224
// read and replace request body
202
225
requestBody , err := io .ReadAll (request .Body )
203
226
if err != nil {
You can’t perform that action at this time.
0 commit comments