chore: add route backend skype tls verification
This commit is contained in:
@@ -16,6 +16,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/jkaninda/goma-gateway/internal/middleware"
|
"github.com/jkaninda/goma-gateway/internal/middleware"
|
||||||
"github.com/jkaninda/goma-gateway/pkg/logger"
|
"github.com/jkaninda/goma-gateway/pkg/logger"
|
||||||
@@ -85,6 +86,11 @@ func (proxyRoute ProxyRoute) ProxyHandler() http.HandlerFunc {
|
|||||||
r.URL.Path = strings.Replace(r.URL.Path, fmt.Sprintf("%s/", proxyRoute.path), proxyRoute.rewrite, 1)
|
r.URL.Path = strings.Replace(r.URL.Path, fmt.Sprintf("%s/", proxyRoute.path), proxyRoute.rewrite, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Custom transport with InsecureSkipVerify
|
||||||
|
proxy.Transport = &http.Transport{TLSClientConfig: &tls.Config{
|
||||||
|
InsecureSkipVerify: proxyRoute.insecureSkipVerify,
|
||||||
|
},
|
||||||
|
}
|
||||||
w.Header().Set("Proxied-By", gatewayName) //Set Server name
|
w.Header().Set("Proxied-By", gatewayName) //Set Server name
|
||||||
w.Header().Del("Server") // Remove the Server header
|
w.Header().Del("Server") // Remove the Server header
|
||||||
// Custom error handler for proxy errors
|
// Custom error handler for proxy errors
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ func (gatewayServer GatewayServer) Initialize() *mux.Router {
|
|||||||
disableHostFording: route.DisableHostFording,
|
disableHostFording: route.DisableHostFording,
|
||||||
methods: route.Methods,
|
methods: route.Methods,
|
||||||
cors: route.Cors,
|
cors: route.Cors,
|
||||||
|
insecureSkipVerify: route.InsecureSkipVerify,
|
||||||
}
|
}
|
||||||
secureRouter := r.PathPrefix(util.ParseRoutePath(route.Path, midPath)).Subrouter()
|
secureRouter := r.PathPrefix(util.ParseRoutePath(route.Path, midPath)).Subrouter()
|
||||||
//callBackRouter := r.PathPrefix(util.ParseRoutePath(route.Path, "/callback")).Subrouter()
|
//callBackRouter := r.PathPrefix(util.ParseRoutePath(route.Path, "/callback")).Subrouter()
|
||||||
@@ -225,6 +226,7 @@ func (gatewayServer GatewayServer) Initialize() *mux.Router {
|
|||||||
methods: route.Methods,
|
methods: route.Methods,
|
||||||
disableHostFording: route.DisableHostFording,
|
disableHostFording: route.DisableHostFording,
|
||||||
cors: route.Cors,
|
cors: route.Cors,
|
||||||
|
insecureSkipVerify: route.InsecureSkipVerify,
|
||||||
}
|
}
|
||||||
// create route
|
// create route
|
||||||
router := r.PathPrefix(route.Path).Subrouter()
|
router := r.PathPrefix(route.Path).Subrouter()
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ type Route struct {
|
|||||||
// Destination Defines backend URL
|
// Destination Defines backend URL
|
||||||
Destination string `yaml:"destination"`
|
Destination string `yaml:"destination"`
|
||||||
Backends []string `yaml:"backends"`
|
Backends []string `yaml:"backends"`
|
||||||
|
InsecureSkipVerify bool `yaml:"insecureSkipVerify"`
|
||||||
// HealthCheck Defines the backend is health
|
// HealthCheck Defines the backend is health
|
||||||
HealthCheck RouteHealthCheck `yaml:"healthCheck"`
|
HealthCheck RouteHealthCheck `yaml:"healthCheck"`
|
||||||
// Cors contains the route cors headers
|
// Cors contains the route cors headers
|
||||||
@@ -243,6 +244,7 @@ type ProxyRoute struct {
|
|||||||
methods []string
|
methods []string
|
||||||
cors Cors
|
cors Cors
|
||||||
disableHostFording bool
|
disableHostFording bool
|
||||||
|
insecureSkipVerify bool
|
||||||
}
|
}
|
||||||
type RoutePath struct {
|
type RoutePath struct {
|
||||||
route Route
|
route Route
|
||||||
|
|||||||
Reference in New Issue
Block a user