|
@@ -98,6 +98,7 @@ func ReverseProxtInit() {
|
|
|
}
|
|
|
|
|
|
func ReverseProxyHandleOnOff(w http.ResponseWriter, r *http.Request) {
|
|
|
+
|
|
|
enable, _ := utils.PostPara(r, "enable") //Support root, vdir and subd
|
|
|
if enable == "true" {
|
|
|
err := dynamicProxyRouter.StartProxyService()
|
|
@@ -106,6 +107,14 @@ func ReverseProxyHandleOnOff(w http.ResponseWriter, r *http.Request) {
|
|
|
return
|
|
|
}
|
|
|
} else {
|
|
|
+ //Check if it is loopback
|
|
|
+ if dynamicProxyRouter.IsProxiedSubdomain(r) {
|
|
|
+ //Loopback routing. Turning it off will make the user lost control
|
|
|
+ //of the whole system. Do not allow shutdown
|
|
|
+ utils.SendErrorResponse(w, "Unable to shutdown in loopback rp mode. Remove proxy rules for management interface and retry.")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
err := dynamicProxyRouter.StopProxyService()
|
|
|
if err != nil {
|
|
|
utils.SendErrorResponse(w, err.Error())
|
|
@@ -267,6 +276,14 @@ func HandleUpdateHttpsRedirect(w http.ResponseWriter, r *http.Request) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//Handle checking if the current user is accessing via the reverse proxied interface
|
|
|
+//Of the management interface.
|
|
|
+func HandleManagementProxyCheck(w http.ResponseWriter, r *http.Request) {
|
|
|
+ isProxied := dynamicProxyRouter.IsProxiedSubdomain(r)
|
|
|
+ js, _ := json.Marshal(isProxied)
|
|
|
+ utils.SendJSONResponse(w, string(js))
|
|
|
+}
|
|
|
+
|
|
|
// Handle incoming port set. Change the current proxy incoming port
|
|
|
func HandleIncomingPortSet(w http.ResponseWriter, r *http.Request) {
|
|
|
newIncomingPort, err := utils.PostPara(r, "incoming")
|