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.
|
||||
*/
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"github.com/jkaninda/goma-gateway/internal/middleware"
|
||||
"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)
|
||||
}
|
||||
}
|
||||
// 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().Del("Server") // Remove the Server header
|
||||
// Custom error handler for proxy errors
|
||||
|
||||
@@ -118,6 +118,7 @@ func (gatewayServer GatewayServer) Initialize() *mux.Router {
|
||||
disableHostFording: route.DisableHostFording,
|
||||
methods: route.Methods,
|
||||
cors: route.Cors,
|
||||
insecureSkipVerify: route.InsecureSkipVerify,
|
||||
}
|
||||
secureRouter := r.PathPrefix(util.ParseRoutePath(route.Path, midPath)).Subrouter()
|
||||
//callBackRouter := r.PathPrefix(util.ParseRoutePath(route.Path, "/callback")).Subrouter()
|
||||
@@ -225,6 +226,7 @@ func (gatewayServer GatewayServer) Initialize() *mux.Router {
|
||||
methods: route.Methods,
|
||||
disableHostFording: route.DisableHostFording,
|
||||
cors: route.Cors,
|
||||
insecureSkipVerify: route.InsecureSkipVerify,
|
||||
}
|
||||
// create route
|
||||
router := r.PathPrefix(route.Path).Subrouter()
|
||||
|
||||
@@ -148,8 +148,9 @@ type Route struct {
|
||||
// Methods allowed method
|
||||
Methods []string `yaml:"methods"`
|
||||
// Destination Defines backend URL
|
||||
Destination string `yaml:"destination"`
|
||||
Backends []string `yaml:"backends"`
|
||||
Destination string `yaml:"destination"`
|
||||
Backends []string `yaml:"backends"`
|
||||
InsecureSkipVerify bool `yaml:"insecureSkipVerify"`
|
||||
// HealthCheck Defines the backend is health
|
||||
HealthCheck RouteHealthCheck `yaml:"healthCheck"`
|
||||
// Cors contains the route cors headers
|
||||
@@ -243,6 +244,7 @@ type ProxyRoute struct {
|
||||
methods []string
|
||||
cors Cors
|
||||
disableHostFording bool
|
||||
insecureSkipVerify bool
|
||||
}
|
||||
type RoutePath struct {
|
||||
route Route
|
||||
|
||||
Reference in New Issue
Block a user