Nginx setup for Java with SSL

Randomly generated Identicon made up of colorful squares in a randomized checkerboard pattern

I spent the better part of Sunday trying to get ssl working with a SpringBoot Java app. Talk about frustrating! I tried numerous guides after my own guess on how to get it working didn't pan out. The challenge centered around Spring Security and its methods of ssl support. Further spicing things up was another non-spring java app that was running just fine with no extra sll config. While Spring Security can be confusing and fiddly in this case ssl is a simple parameter setting.

So my app having challenges, is a drop-in replacement for gPodder API which seems to have quit taking sign-ups, so I wrote my one. That's a little spoiler for a new FOSS app i'll be releasing later in the week.

Back to the story, for some reason njinx just wasn't passing the ssl cert information in a manner pleasing to Spring, and the connection kept redirecting to another site I have configured in nginx. I knew it had to be a config issue in nginx because of that and of course the unprotected http requests worked fine. After trying all sorts of configurations I finally search up the following article from Hextechie - Spring Boot With Nginx. This is really configuration gold and helped me sort out the config. I'm a nginx noob so I don't know the details on the configurations but this helped me fill in gaps such as adding the OCSP chain CA and ensuring the right headers were forwarded to the java app.

Thought it would be nice to link to this to give it search mojo and also provide a reminder to me when I have to do this again anf have forgotten the details!

Tag Cloud