Skip to content

Commit

Permalink
Fixed small bug with rewriting not including the correct locations
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobm-splunk authored and daveshanley committed Apr 28, 2024
1 parent b7afdfb commit 2455314
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions daemon/handle_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,15 @@ func setStrictLocationHeader(config *shared.WiretapConfiguration, headers map[st
if parseErr != nil {
config.Logger.Warn(fmt.Sprintf("Unable to parse `Location` header URL: %s", location))
newLocations = append(newLocations, location)

// Check if the target location's host differs from wiretap's host
} else if parsedLocation.Host != apiGatewayHost {
} else if parsedLocation.Host != apiGatewayHost { // Check if the target location's host differs from wiretap's host
parsedLocation.Host = apiGatewayHost

newLocation := parsedLocation.String()
config.Logger.Info(fmt.Sprintf("Rewrote `Location` header from %s to %s", location, newLocation))

newLocations = append(newLocations, newLocation)
} else { // Otherwise, we need to re-add the old location
newLocations = append(newLocations, location)
}

}
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ github.com/pb33f/libopenapi-validator v0.0.44 h1:z7SVS6mMVv/f4V73e9H1UCiWrMzMg2u
github.com/pb33f/libopenapi-validator v0.0.44/go.mod h1:kU1JYyXIRlpmsWx3NkL+drNNttLADMgdaNzJgXDhec0=
github.com/pb33f/libopenapi-validator v0.0.45 h1:UxTeaxwi2URM9RQlXNbke3zeibijz2kA28T3zVhmp/A=
github.com/pb33f/libopenapi-validator v0.0.45/go.mod h1:kU1JYyXIRlpmsWx3NkL+drNNttLADMgdaNzJgXDhec0=
github.com/pb33f/libopenapi-validator v0.0.48/go.mod h1:kU1JYyXIRlpmsWx3NkL+drNNttLADMgdaNzJgXDhec0=
github.com/pb33f/ranch v0.4.0 h1:fve9Lozc9m0IGkygWD3EFkBtbRua+2gyi9yxYHvufh4=
github.com/pb33f/ranch v0.4.0/go.mod h1:LfZITTWTb1quxakzKr2RErDdSGOrxV/dpai9DK4Aa6k=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
Expand Down

0 comments on commit 2455314

Please sign in to comment.