chore: add route backend skype tls verification

This commit is contained in:
Jonas Kaninda
2024-11-14 22:30:36 +01:00
parent e8878d795e
commit 88c0be1b63
3 changed files with 12 additions and 2 deletions

View File

@@ -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