Home > Mobile >  How to point a CNAME to an OpenShift route
How to point a CNAME to an OpenShift route

Time:09-17

My application that is hosted on OpenShift has a route with a URL that looks like this:

https://books-student-book-reservation-backend-project.apps.amarige.hostname.us

I want to give end users a URL that looks like this: https://breeze.us. First it hides the OpenShift URL structure, second it is easier to remember. Bottom line it's more user friendly.

The challenge is that when I redirect breeze.us to the OpenShift route, I get "Application is not available" error from OpenShift.

Any suggestion on how to resolve this?

CodePudding user response:

https://docs.openshift.com/online/pro/dev_guide/routes.html#custom-route-and-hosts-and-certificates-restrictions

If you are using OpenShift Online

In OpenShift Online Starter, custom hostname is not permitted. You can either buy OpenShift Online Pro (which allows custom hostname to be set), or use a reverse proxy to redirect your traffic (from another server with the custom hostname) to OpenShift.

If you are using self-deployed OKD

You can set a custom hostname for your route like this:

# A example unsecured route with custom hostname
apiVersion: v1
kind: Route
metadata:
  name: route-unsecured
spec:
  host: www.your-custom-hostname.com  # here
  to:
    kind: Service
    name: service-name

If you need to serve multiple routes under the same hostname, you can also do path-based route with custom hostname:

# A example unsecured path-based route with custom hostname
apiVersion: v1
kind: Route
metadata:
  name: route-unsecured
spec:
  host: www.your-custom-hostname.com
  path: "/test"      # here
  to:
    kind: Service
    name: service-name

So that you can use www.your-custom-hostname.com/test to access your route.

  • Related