Skip to content

Commit

Permalink
Enable HTTP/2 and SSL with Undertow key/trust stores
Browse files Browse the repository at this point in the history
Stores are taken from Undertow examples. The web demo now creates two
listeners with the additional SSL port, 8443 by default. I'm not sure
this will work well for Heroku/OpenShift.

Note the use of string keys in web/-main, allowing the values to be
overridden on the command line. This is particularly useful when running
from the jar since the alpn jar needs to be in the bootclasspath.
  • Loading branch information
jcrossley3 committed Nov 22, 2015
1 parent aebb6e2 commit 9f1fb50
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -44,7 +44,7 @@ Once at a prompt, try `(demo.web/-main)`
Create an uberjar and run it

lein uberjar
java -jar target/demo-standalone.jar
java -jar target/demo-standalone.jar :http2? false

## In WildFly

Expand Down
6 changes: 4 additions & 2 deletions project.clj
Expand Up @@ -4,7 +4,7 @@
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[org.immutant/immutant "2.1.1"]
[org.immutant/immutant "2.x.incremental.692"]
[compojure "1.3.4"]
[ring/ring-devel "1.3.1"]
[org.clojure/core.memoize "0.5.6"]
Expand All @@ -15,7 +15,9 @@
[com.h2database/h2 "1.3.176"]]
:repositories [["Immutant incremental builds"
"http://downloads.immutant.org/incremental/"]]
:plugins [[lein-immutant "2.1.0"]]
:plugins [[lein-immutant "2.1.0"]
[info.sunng/lein-bootclasspath-deps "0.2.0"]]
:boot-dependencies [[org.mortbay.jetty.alpn/alpn-boot "8.1.5.v20150921" :prepend true]]
:main demo.core
:uberjar-name "demo-standalone.jar"
:min-lein-version "2.4.0"
Expand Down
Binary file added resources/server.keystore
Binary file not shown.
Binary file added resources/server.truststore
Binary file not shown.
8 changes: 7 additions & 1 deletion src/demo/web.clj
Expand Up @@ -54,5 +54,11 @@
{:timeout 20})
#_(immutant.web.middleware/wrap-websocket
{:on-open (fn [ch] (println "You opened a websocket!"))}))
(merge {"host" (env :demo-web-host), "port" (env :demo-web-port)}
(merge {"host" (env :demo-web-host), "port" (env :demo-web-port 8080)}
{"http2?" true
"ssl-port" 8443
:keystore "resources/server.keystore"
:key-password "password"
:truststore "resources/server.truststore"
:trust-password "password"}
args)))

0 comments on commit 9f1fb50

Please sign in to comment.