-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Proxy: Better errors + remote custom TLS #1197
Conversation
blaubaer
commented
Sep 23, 2018
- Added better logging on connection issues to remote hosts.
- Make transport customization to enable (for example) custom remote TLS certificates.
…m transport (example: for custom TLS certificates)
Codecov Report
@@ Coverage Diff @@
## master #1197 +/- ##
==========================================
+ Coverage 81.52% 81.61% +0.09%
==========================================
Files 25 27 +2
Lines 1921 1931 +10
==========================================
+ Hits 1566 1576 +10
Misses 248 248
Partials 107 107
Continue to review full report at Codecov.
|
middleware/proxy_1_11.go
Outdated
if len(t.Name) > 0 { | ||
descr = fmt.Sprintf("%s(%s)", t.Name, t.URL.String()) | ||
} | ||
c.Logger().Warnf("remote %s unreachable, could not forward: %v", descr, err) |
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.
Looks like this is an error, what do you think?
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.
Depends what we understand as an error, right? The issue is that the remote is not available is automatically an configuration problem, or a wrong written code of the application. I would say no, but I also can understand if you go for error
rather than warn
. Your call. 😃
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.
Well configuration is one of the case, it could also be possible where upstream server is not available. I would stick to error as we cannot recover from this.
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.
I got you point. I will change it accordingly.
middleware/proxy_1_11.go
Outdated
proxy := httputil.NewSingleHostReverseProxy(t.URL) | ||
proxy.ErrorHandler = func(resp http.ResponseWriter, req *http.Request, err error) { | ||
descr := t.URL.String() | ||
if len(t.Name) > 0 { |
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.
Use t.Name != ""
, it is more natural.
@blaubaer thanks for your contribution 👍 |