-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from CrowdStrike/proxy-requests
Proxy requests
- Loading branch information
Showing
7 changed files
with
80 additions
and
15 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# avoid issues with bracket spacing around e.g. {{ .Release.Namespace }} | ||
# https://github.com/redhat-developer/vscode-yaml/issues/246 | ||
charts/openshift-console-plugin/templates/*.yaml |
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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { consoleFetch } from '@openshift-console/dynamic-plugin-sdk'; | ||
|
||
export default function proxiedFetchFactory(cloud) { | ||
return (url, options) => { | ||
// make requests to our reverse proxy instead of directly to the CrowdStrike API, since it doesn't | ||
// support arbitrary CORS | ||
const proxyBase = '/api/proxy/plugin/falcon-openshift-console-plugin/reproxy/crwdapi'; | ||
const path = url.substr(url.indexOf('.com') + 4); | ||
|
||
// add region to request header so our reverse proxy can forward correctly | ||
if (!options.headers) { | ||
options.headers = {}; | ||
} | ||
options.headers['X-CS-REGION'] = cloud; | ||
|
||
// use consoleFetch to ensure CSRF headers are added | ||
return consoleFetch(proxyBase + path, options); | ||
}; | ||
} |
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