mirror of
https://github.com/dcarrillo/whatismyip.git
synced 2025-07-03 06:39:26 +00:00
Remove headers set by a trusted proxy from outputs
This commit is contained in:
@ -79,8 +79,8 @@ func getAllAsString(ctx *gin.Context) {
|
||||
output += geoASNRecordToString(record) + "\n"
|
||||
}
|
||||
|
||||
h := ctx.Request.Header
|
||||
h["Host"] = []string{ctx.Request.Host}
|
||||
h := httputils.GetHeadersWithoutTrustedHeaders(ctx)
|
||||
h.Set("Host", ctx.Request.Host)
|
||||
output += httputils.HeadersToSortedString(h)
|
||||
|
||||
ctx.String(http.StatusOK, output)
|
||||
@ -113,6 +113,6 @@ func jsonOutput(ctx *gin.Context) JSONResponse {
|
||||
ASN: asnRecord.AutonomousSystemNumber,
|
||||
ASNOrganization: asnRecord.AutonomousSystemOrganization,
|
||||
Host: ctx.Request.Host,
|
||||
Headers: ctx.Request.Header,
|
||||
Headers: httputils.GetHeadersWithoutTrustedHeaders(ctx),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user