-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: use mtls between frontend and backend #37
base: main
Are you sure you want to change the base?
Conversation
ca7a09e
to
57215c4
Compare
55532f5
to
b3f3d98
Compare
previously websockets true flag was ignored
b3f3d98
to
4018916
Compare
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.
TIL about creating and using certs, thanks for the initiative 😊
A few comments, but looks so good so far. Tested running the servers with and without certificates.
Co-authored-by: Cammille Carinan <[email protected]>
Ensures that the file exists
) | ||
} | ||
|
||
const baseURL = new URL(VITE_URL) |
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.
We should probably avoid hardcoding the URL with the host and the port, as it might be best for it to be dynamic and accounting in which machine it is run (host), and the supplied port that could also come from the CLI argument.
The VITE_BASE_URL
from before is for custom base path such as localhost:port/<BASE_URL>
, which follows the following notation on https://vite.dev/config/shared-options.html#base. It is stored as environment variable as the proxies should also follow e.g., localhost:port/<BASE_URL>/graphql
. Maybe the BASE_URL
name was a bit misleading, sorry about that!
key: fs.readFileSync(path.resolve(__dirname, VITE_MTLS_KEY)), | ||
cert: fs.readFileSync(path.resolve(__dirname, VITE_MTLS_CERT)), | ||
ca: fs.readFileSync(path.resolve(__dirname, VITE_MTLS_CA)), | ||
} |
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've tested locally, I found that adding these two helps making things compatible:
} | |
secureProtocol: "TLSv1_2_method", | |
ciphers: [ | |
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", | |
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", | |
].join(":"), | |
} |
MR sets up API server to only communicate via mTLS and configures the frontend to proxy requests through with the required certificates.
TODO: