mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 00:21:55 +00:00
fix X-Forwarded-For
This commit is contained in:
parent
16531f9fa1
commit
d2e309b699
@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.m2.nz/go-scrobble/internal/goscrobble"
|
||||
"github.com/joho/godotenv"
|
||||
"gitlab.com/idanoo/go-scrobble/internal/goscrobble"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -16,6 +16,8 @@ These are stored in `web/.env.production` and `web/.env.development`
|
||||
REDIS_PREFIX="gs:" // Redis key prefix
|
||||
REDIS_AUTH="" // Redis password
|
||||
|
||||
TIMEZONE= // Used for MySQL connection
|
||||
|
||||
JWT_SECRET= // 32+ Char JWT secret
|
||||
JWT_EXPIRY=86400 // JWT expiry
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
||||
module git.m2.nz/go-scrobble
|
||||
module gitlab.com/idanoo/go-scrobble
|
||||
|
||||
go 1.16
|
||||
|
||||
|
@ -45,10 +45,11 @@ func getUserIp(r *http.Request) net.IP {
|
||||
var ip net.IP
|
||||
host, _, _ := net.SplitHostPort(r.RemoteAddr)
|
||||
if contains(ReverseProxies, host) {
|
||||
forwardedFor := r.Header.Get("X-FOWARDED-FOR")
|
||||
forwardedFor := r.Header.Get("X-Forwarded-For")
|
||||
if forwardedFor != "" {
|
||||
host = forwardedFor
|
||||
}
|
||||
// realIp := r.Header.Get("X-Real-IP")
|
||||
}
|
||||
|
||||
ip = net.ParseIP(host)
|
||||
|
@ -10,11 +10,11 @@ function Home() {
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://git.m2.nz/idanoo/go-scrobble"
|
||||
href="https://gitlab.com/idanoo/go-scrobble"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
git.m2.nz/idanoo/go-scrobble
|
||||
gitlab.com/idanoo/go-scrobble
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user