fix: issue with capturing correct client ip

This commit is contained in:
rawleyIfowler
2022-03-03 13:21:26 -06:00
parent df4cc066f2
commit 4a5ad21b27
2 changed files with 2 additions and 1 deletions

View File

@@ -118,7 +118,7 @@ func CreateComment(c *gin.Context) {
}
db.Create(&comment)
// Something was wrong with c.ClientIP() with trusted?? Weird.
recentPosters[c.Request.Header.Get("X-Forwarded-For")]++
recentPosters[c.ClientIP()]++
// Pass the associated post to the template to add to the href
c.HTML(http.StatusOK, "comment_post.tmpl", CommentDto{Url: comment.AssociatedPost})
}