Browse Source

fix: authorization failed when link start to a wrong environment #342

Jacky 1 year ago
parent
commit
d0924eb4ae
2 changed files with 6 additions and 1 deletions
  1. 1 1
      app/src/views/dashboard/Environments.vue
  2. 5 0
      router/proxy.go

+ 1 - 1
app/src/views/dashboard/Environments.vue

@@ -120,7 +120,7 @@ const visible = computed(() => {
 
                 <AButton
                   type="primary"
-                  :disabled="env.id === item.id"
+                  :disabled="!item.status || env.id === item.id"
                   ghost
                   @click="link_start(item)"
                 >

+ 5 - 0
router/proxy.go

@@ -79,6 +79,11 @@ func proxy() gin.HandlerFunc {
 
 		defer resp.Body.Close()
 
+		// rewrite status code to fix https://github.com/0xJacky/nginx-ui/issues/342
+		if resp.StatusCode == http.StatusForbidden {
+			resp.StatusCode = http.StatusServiceUnavailable
+		}
+
 		c.Writer.WriteHeader(resp.StatusCode)
 
 		c.Writer.Header().Add("Content-Type", resp.Header.Get("Content-Type"))