-
Notifications
You must be signed in to change notification settings - Fork 617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add https upstream support #257
Conversation
@shadowfax-chc Thanks for working on this but this isn't correct. There are two TCP connections in play here: one inbound and one outbound/upstream. The listener is the inbound TCP connection and the proxy is the outbound TCP connection. To allow outbound This requires however that the certificates can be validated through the default root CAs as configured on the system. If you want to allow certificate verification with a custom certificate source then this must be configured in the Lets start with supporting To support
Once we find a way to have a custom client/transport per request this solution can easily be refactored. You don't have to (and shouldn't) configure the Also, please provide an integration test for both cases in |
Ah, that makes sense. Let me make sure I am setting this option in the correct place now, and I will get some tests. |
route/route.go
Outdated
@@ -70,6 +71,13 @@ func (r *Route) addTarget(service string, targetURL *url.URL, fixedWeight float6 | |||
} | |||
if r.Opts != nil { | |||
t.StripPath = r.Opts["strip"] | |||
|
|||
tlsskipverify := false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is enough since this is also in line with the option parser in config
t.TLSSkipVerify := r.Opts["skipverify"] == "true"
proxy/http_proxy.go
Outdated
@@ -20,6 +20,8 @@ type HTTPProxy struct { | |||
// The proxy will panic if this value is nil. | |||
Transport http.RoundTripper | |||
|
|||
InsecureTransport http.RoundTripper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls add a comment.
route/target.go
Outdated
@@ -32,4 +32,7 @@ type Target struct { | |||
|
|||
// timerName is the name of the timer in the metrics registry | |||
timerName string | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"TLSSkipVerify disables certificate validation for upstream TLS connections."
Could you also move the variable below the StripPath
variable, please?
main.go
Outdated
@@ -101,6 +101,17 @@ func newHTTPProxy(cfg *config.Config) http.Handler { | |||
KeepAlive: cfg.Proxy.KeepAliveTimeout, | |||
}).Dial, | |||
}, | |||
InsecureTransport: &http.Transport{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move this into a local newTransport := func(tlscfg *tls.Config) http.Transport
func to avoid the duplication.
Oh, I can actually change the files myself now. Interesting. Didn't know that. |
I'll try that on the next PR, though. |
If `proto=https` option is set on a route, set the protocal to https
@magiconair made the requested changes and added tests |
LGTM. Merged it. Thank you! |
Update fabio.properties documentation
This seems to work for me. I generally have a internal root CA that is trusted via standard system certs. The
skipverify
option could be used to deal with self-signed certs, but would obviously skip verification.I was also thinking of maybe having another certificate store for CAs that could then be selected via a tag option. If that seems like a good idea I can make another PR or amend this one.
Ref: #181