This repository has been archived by the owner on Jan 27, 2022. It is now read-only.
KOGITO-5715: Online DMN Editor should support deployment to any Openshift Cluster other than Dev Sandbox #21
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ package kogito | |
import ( | ||
"bufio" | ||
"context" | ||
"crypto/tls" | ||
"net" | ||
|
||
"encoding/json" | ||
"fmt" | ||
|
@@ -197,6 +199,24 @@ func devSandboxHandler() func(w http.ResponseWriter, r *http.Request) { | |
r.Host = r.URL.Host | ||
|
||
proxy := httputil.NewSingleHostReverseProxy(targetUrl) | ||
|
||
// tolerate self-signed certificates | ||
proxy.Transport = &http.Transport{ | ||
Proxy: http.ProxyFromEnvironment, | ||
DialContext: (&net.Dialer{ | ||
Timeout: 30 * time.Second, | ||
KeepAlive: 30 * time.Second, | ||
}).DialContext, | ||
ForceAttemptHTTP2: true, | ||
MaxIdleConns: 10, | ||
IdleConnTimeout: 60 * time.Second, | ||
TLSHandshakeTimeout: 10 * time.Second, | ||
ExpectContinueTimeout: 1 * time.Second, | ||
TLSClientConfig: &tls.Config{ | ||
InsecureSkipVerify: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This creates a security issue as described in the docs. I think asking the user if he wants to disable this check would be a better solution, WDYT? For now, it's not a problem, so I can create a JIRA to add this functionality eventually. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. I understand. I believe the right way is to have this parameterized. Maye adding an option to config the service from the System Tray. Without this setting, the service can't connect to Openshift Cluster that uses self-signed certificates. |
||
}, | ||
} | ||
|
||
proxy.ModifyResponse = func(resp *http.Response) error { | ||
resp.Header.Add("Access-Control-Allow-Origin", "*") | ||
resp.Header.Add("Access-Control-Allow-Methods", "*") | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't believe we set any env variable that can be used by
ProxyFromEnvironment
, so I'm not sure if this line is being used. https://pkg.go.dev/net/http#ProxyFromEnvironmentThere 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.
Hi @ljmotta . Neither am I :-) But I realized that if we don't set this the default value will be
nil
. Anyway, this would only affect users that have (rely on) some proxy (to access the Internet) configured in the system environment (OS level). Not sure...