Add ability to set up allowed paths for proxying.

This commit is contained in:
2023-10-12 14:12:03 +01:00
parent f41b2ae46f
commit 815a6841ed
5 changed files with 38 additions and 1 deletions
+8 -1
View File
@@ -9,8 +9,15 @@ import (
)
func proxyTheRequest(c *fiber.Ctx) error {
if !checkAllowedURLs(c) {
cfg.Logger.Error("Request blocked", map[string]interface{}{"path": c.Path()})
cfg.Monitoring.Increment(libpack_monitoring.MetricsSkipped, nil)
c.Status(403).SendString("Request blocked - not allowed URL")
return nil
}
c.Request().Header.Add("X-Real-IP", c.IP())
c.Request().Header.Add("X-Forwarded-For", c.IP())
c.Request().Header.Add(fiber.HeaderXForwardedFor, string(c.Request().Header.Peek("X-Forwarded-For")))
proxy.WithTlsConfig(&tls.Config{
InsecureSkipVerify: true,