fix: Use IP from X-Forwarded-For when available

This commit is contained in:
ptrcnull 2023-04-11 01:59:51 +02:00
parent 5fb29668c8
commit d724154635
Signed by: ptrcnull
GPG key ID: 411F7B30801DD9CA

View file

@ -124,7 +124,7 @@ func (h *Handler) CreateHandler(wr http.ResponseWriter, req *http.Request) {
} }
req.ParseForm() req.ParseForm()
code, err := h.GetCode(req.Form.Get("url"), req.RemoteAddr) code, err := h.GetCode(req.Form.Get("url"), ip)
if err != nil { if err != nil {
Render(wr, map[string]string{"error": err.Error()}) Render(wr, map[string]string{"error": err.Error()})
} else { } else {