How deploy Spring boot SSL project in openshift

Viewed 904

I have a spring project with SSL on by which i mean:

in my application.properties

security.require-ssl=true

So locally if i run it, like http://localhost:8080, i get

Bad Request
This combination of host and port requires TLS.

If i run it https://localhost:8080, It works.

I was trying to deploy this project to openshift

In my Dockerfile,

Expose 8080

in my openshift deployment yaml file:

a deployment config with 
ports:
 - containerPort: 8080
   protocol: TCP

- kind: Service
    apiVersion: v1
    metadata:
      name: APP_NAME
    spec:
      ports:
        - name: http
          port: 80
          protocol: TCP
          targetPort: 8080
      selector:
        app: APP_NAME
        deploymentconfig: APP_NAME

When i create route in openshift which is a https route and lets say it is: https://springboot-sample-boot.opnshift.com and go to it, i get:

Bad Request
This combination of host and port requires TLS.

and it uses these routes: ports:

- name: http
  port: 80
  protocol: TCP
  targetPort: 8080

As my knowledge, the openshift routes/url is listening to port 80 which redirects to containers 8080 port.

I see in the pods, https route is open in 8080:

Tomcat started on port(s): 8080 (https) with context path ''

But openshift https route is not correctly routing to pods.

Please help. Thank you.

0 Answers
Related