diff --git a/.env b/.env index 249764d..2005411 100644 --- a/.env +++ b/.env @@ -1,4 +1,5 @@ DB_HOST=localhost DB_USER=besucher DB_PASS=besucher -DB_DATA=besucher \ No newline at end of file +DB_DATA=besucher +PROXYIP=172.19.0.2 \ No newline at end of file diff --git a/app.go b/app.go index 815c23e..9154021 100644 --- a/app.go +++ b/app.go @@ -12,13 +12,15 @@ import ( ) type App struct { - r *gin.Engine - db *gorm.DB + r *gin.Engine + proxyips []string + db *gorm.DB } func (a *App) start() { a.db.AutoMigrate(&planner.Besucher{}) a.r.Use(CORSMiddleware()) + a.r.SetTrustedProxies(a.proxyips) a.r.NoRoute((func(c *gin.Context) { dir, file := path.Split(c.Request.RequestURI) ext := filepath.Ext(file) diff --git a/main.go b/main.go index d532a9f..85deb10 100644 --- a/main.go +++ b/main.go @@ -28,8 +28,9 @@ func main() { panic(err.Error()) } app := App{ - db: db, - r: gin.Default(), + db: db, + r: gin.Default(), + proxyips: []string{"172.19.0.2"}, } app.start() //r := gin.Default()