Skip to content

Commit 5d98715

Browse files
committed
fix: adjust restart disabled handling
1 parent 8170cf4 commit 5d98715

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

internal/pkg/service/appsproxy/proxy/apphandler/upstream/upstream.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ func (u *AppUpstream) trace() chain.Middleware {
197197
DNSDone: func(info httptrace.DNSDoneInfo) {
198198
if info.Err != nil {
199199
u.wakeup(ctx, info.Err)
200+
} else {
201+
u.restartDisabled.Store(false)
200202
}
201203
},
202204
})

internal/pkg/service/appsproxy/proxy/pagewriter/restart_disabled.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type RestartDisabledPageData struct {
1313
func (pw *Writer) WriteRestartDisabledPage(w http.ResponseWriter, req *http.Request, app api.AppConfig) {
1414
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate;")
1515
w.Header().Set("pragma", "no-cache")
16-
pw.writePage(w, req, "restart_disabled.gohtml", http.StatusNotFound, RestartDisabledPageData{
16+
pw.writePage(w, req, "restart_disabled.gohtml", http.StatusServiceUnavailable, RestartDisabledPageData{
1717
App: NewAppData(&app),
1818
})
1919
}

internal/pkg/service/appsproxy/proxy/proxy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ func TestAppProxyRouter(t *testing.T) {
18421842
require.NoError(t, err)
18431843
response, err := client.Do(request)
18441844
require.NoError(t, err)
1845-
if response.StatusCode == http.StatusNotFound {
1845+
if response.StatusCode == http.StatusServiceUnavailable {
18461846
body, err := io.ReadAll(response.Body)
18471847
require.NoError(t, err)
18481848
return strings.Contains(string(body), "Application Disabled")

0 commit comments

Comments
 (0)