Openshift DIY Dropwizard with HTTPS

599 Views Asked by At

I got my Dropwizard application running in an Openshift DIY Cartridge.

The application uses Https and binds to port 8080. I can access the application with curl from within an ssh connection via rhc ssh appname.

What do I have do configure that I can access my Dropwizard application via the appname-username.rhcloud.com domain?

I always get a proxy error 502. Error reading from remote server.

Any suggestion is greatly appreciated.

tmy

1

There are 1 best solutions below

2
On BEST ANSWER

In OpenShift your application is deployed behind a proxy server ant this proxy server can only communicate with your application using http.

The OpenShift proxy server allows you to use both http and https connections and to communicate which type of connection was used the proxy server adds x-forwarded headers in the request to your application.

Tho configure Dropwizard, you will need to configure the http connector on port 8080, the default, and set useForwardedHeaders to true, also the default. See http://dropwizard.io/manual/configuration.html#http for more information.

At this point Dropwizard is aware whether a http or https connection was used. The thing I did not find is how to make content "confidential" so that the jetty container inside Dropwizard redirect the client to the https connector served by the OpenShift proxy server when the client tries to connect to your application using http.