-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
hi,
I wanted to switch from nginx to traefik as proxy to forward to clammit.
therefor i was looking how to set the X-Clammit-Backend with the given traefik possibilities.
I did not find any solution suitable for my needs.
my solution now is to patch your forwarder.go:
func (f *Forwarder) getApplicationURL(req *http.Request) *url.URL {
// Return the applicationURL if it's set
if f.applicationURL != nil && f.applicationURL.String() != "" {
return f.applicationURL
}
// Otherwise check for the X-Clammit-Backend header
url, err := url.Parse(req.Header.Get(applicationUrlHeader))
if err != nil {
f.logger.Panicf("Error parsing application URL in %s: %s (%s)", applicationUrlHeader, err.Error(), req.Header.Get(applicationUrlHeader))
return nil
}
if len(url.String()) == 0 {
**f.logger.Print("No application URL available - header %s is blank", applicationUrlHeader)
// patch by Top21
f.logger.Print("Try to build from X-Forwarded-")
url,err = url.Parse(req.Header.Get("X-Forwarded-Proto") + "://" + req.Header.Get("X-Forwarded-Host"))**
}
return url
}
maybe this is helpful for others too and you can implement it somehow in the main code.
cheers,
frank
Metadata
Metadata
Assignees
Labels
No labels