Client HTTPS configuration #4366
-
I'm following the configuration to setup HTTPS port on the Docker server with server.cert_file and server.cert_key, but I was wondering if the Java and React clients require any special configuration to connect via HTTPS? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 18 replies
-
Hi @cristianonicolai! I'm Dosu and I’m helping the flipt team. No special configuration is needed for Java or React clients to connect via HTTPS as long as the server presents a certificate trusted by the client environment. The Java client uses the standard Java runtime for HTTPS, so if you're using a certificate from a public CA, it should work out of the box. If you're using a self-signed certificate, you'll need to add your CA to the JVM's trust store. The React client relies on the browser's HTTPS handling—if the certificate is trusted by the browser, everything will work; if not (e.g., self-signed), the browser will show a warning. There are no Flipt-specific SSL/TLS settings required in either client—just set the URL to use To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
Im using a self-signed certificate to connect from the Java client to a Flipt server. On the server I've setup both FLIPT_SERVER_CERT_FILE and FLIPT_SERVER_CERT_KEY accordingly. Also, FLIPT_SERVER_PROTOCOL=https and FLIPT_SERVER_HTTPS_PORT=8443 since running as non-root. On the Java side. tried using the default JVM truststore with the custom certificate as well as adding SSL_CERT_FILE env var from Rust, but none worked. On the Flipt server, I keep getting: http: TLS handshake error from 192.168.228.178:37898: remote error: tls: unknown certificate. |
Beta Was this translation helpful? Give feedback.
-
Some extra info. I'm running from an alpine based container. Since adding the self-signed certificate to /etc/ssl/certs/ca-certificates.crt, I can wget into Flipt's https port without issues. If there was an env var like SSL_CERT_FILE we could rely on, that would be ideal. |
Beta Was this translation helpful? Give feedback.
-
@cristianonicolai I think you are correct that we might need to add support for self-signed certs in the Rust layer as it uses the reqwest crate to do the HTTP(S) calls. Heres a blog post where someone does something similar with self-signed certs and reqwest: https://maisyt.hashnode.dev/importing-a-self-signed-cert-for-a-rust-reqwest-http-client Question: how are you generating the self-signed cert? This way I can generate my own following your same process and try to get it working with reqwest. |
Beta Was this translation helpful? Give feedback.
-
@markphelps we use Letsecrypt to generate the certificates and these are usually rotated in a Kubernets envrionment. Thats why having a way to point to the file would be best, otherwise we need to keep importing the cert into the OS every time it changes. |
Beta Was this translation helpful? Give feedback.
-
@cristianonicolai It will take a while to get self-signed TLS support in all the SDKs but I got it working in Python flipt-io/flipt-client-sdks#1134 and will now prioritize Java and JS/React next. You can track the progress in flipt-io/flipt-client-sdks#1132 |
Beta Was this translation helpful? Give feedback.
-
@cristianonicolai v 1.1.0 of the Java SDK now supports custom TLS config (https://github.com/flipt-io/flipt-client-sdks/tree/main/flipt-client-java#tls-configuration) The React/JS sdks may take a big longer as I have no idea how this works with the fetch API |
Beta Was this translation helpful? Give feedback.
-
@cristianonicolai ok.. i think I finally figured it out. after many tries I finally found a combination that works at least with my testing. Can you update your dependency to version 1.1.1-rc.7 to get these fixes? If its successful I'll create The issue was in the What was fixed?Version 1.1.1-rc.7 includes two major fixes:
How to update your codeReplace the deprecated static methods with the new builder pattern: TlsConfig tlsConfig = TlsConfig.builder()
.caCertFile("/path/to/your/ca.pem")
.insecureSkipHostnameVerify(true) // This is likely what you need
.build();
FliptClient client = FliptClient.builder()
.url("https://your-flipt-server:8443")
.tlsConfig(tlsConfig)
.authentication(new ClientTokenAuthentication("your-token"))
.build(); |
Beta Was this translation helpful? Give feedback.
@markphelps good news here, I was able to pin point the issue on the certificate that was causing the connection error. Our tls.crt did contain the following:
That's definitely not necessary since it won't issue any certificate. Strangely enough, other Java based systems did not complain about that. Again, having extra details in the logs could have helped to find the exact issue.
If you could generate a new, final version of the Java client, that way we can move forward with our deployment. Again, thanks for all your help on this issue.