Account for forwarding in IP address for rate limiting

main
Cameron Murphy Reikes 2 years ago
parent 0f7e1c60c7
commit 690c2a1e5f

@ -270,6 +270,9 @@ func completion(w http.ResponseWriter, req *http.Request) {
// where I do the IP rate limiting
userKey := req.RemoteAddr
if req.Header.Get("X-Forwarded-For") != "" {
userKey = req.Header.Get("X-Forwarded-For")
}
createdTime, ok := ipAddyTenFree[userKey]
if !ok {
ipAddyTenFree[userKey] = currentTime()

Loading…
Cancel
Save