Member-only story

Regexp Rule for HTTPS of Traefik

Zhimin Wen
2 min readMay 31, 2022

--

Image by Pexels from Pixabay

I use Traefik as a reverse proxy to expose my application running on OpenShift.

To expose the HTTPS service, which is configured as a route of TCP, I will need the following sample configuration in TOML format,

[tcp.routers.dev-ocp410-https]
entryPoints = ["https"]
rule = "HostSNI(`oauth-openshift.apps.dev-ocp410.ibmcloud.io.cpak`,`console-openshift-console.apps.dev-ocp410.ibmcloud.io.cpak`,)"
service = "service-dev-ocp410-https"
[tcp.routers.dev-ocp410-https.tls]
passthrough = true

I have to include each individual URL (hostname portion for Server Name Indication) for the services in the HostSNI functions. As the HostSNI function does not support regex-based matching, I need to define the full hostname and join them as a list. The above 2 URLs are just the URLs for the OCP web console login. For other platform services, a list like the below is common,

rule =…

--

--

No responses yet