-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 TLS support for metric beat http server #11611
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
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 left a minor comment. But everything else LGTM.
@@ -130,6 +148,11 @@ func (h *HttpServer) handleFunc(writer http.ResponseWriter, req *http.Request) { | |||
|
|||
case "GET": | |||
writer.WriteHeader(http.StatusOK) | |||
writer.Write([]byte("HTTP Server accepts data via POST")) | |||
if h.server.TLSConfig != nil && h.server.TLSConfig.Certificates != nil { |
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.
The request itself can tell you if it was received over TLS: if req.TLS != nil
. Sorry to bother you about this line again, but the thought came to be late.
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.
No problem. It looks better this way. Let me test it...
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.
@andrewkroh Done, tested ok
Update config.go Update http.go Update config.go Adding ssl tests, adjusting review requests Line update Line Update req.TLS check
jenkins, test this |
@@ -130,6 +148,11 @@ func (h *HttpServer) handleFunc(writer http.ResponseWriter, req *http.Request) { | |||
|
|||
case "GET": | |||
writer.WriteHeader(http.StatusOK) | |||
writer.Write([]byte("HTTP Server accepts data via POST")) | |||
if req.TLS != nil { | |||
writer.Write([]byte("HTTPS Server accepts data via POST")) |
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.
tip: io.WriteString(writer, "...")
.
Solves #11457