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