Browse Source

Try to fix issue with Host header

master
harture 7 years ago
parent
commit
fe4be8ecca
  1. 4
      keycloak_client.go

4
keycloak_client.go

@ -247,6 +247,7 @@ func (c *Client) put(accessToken string, plugins ...plugin.Plugin) error {
req = applyPlugins(req, plugins...) req = applyPlugins(req, plugins...)
req, err = setAuthorisationAndHostHeaders(req, accessToken) req, err = setAuthorisationAndHostHeaders(req, accessToken)
if err != nil { if err != nil {
return err return err
} }
@ -280,7 +281,8 @@ func setAuthorisationAndHostHeaders(req *gentleman.Request, accessToken string)
} }
var r = req.SetHeader("Authorization", fmt.Sprintf("Bearer %s", accessToken)) var r = req.SetHeader("Authorization", fmt.Sprintf("Bearer %s", accessToken))
return r.SetHeader("Host", host), nil r.Context.Request.Host = host
return r, nil
} }
// applyPlugins apply all the plugins to the request req. // applyPlugins apply all the plugins to the request req.

Loading…
Cancel
Save