Grails + Spring Security Core + Tomcat SSL + Nginx
A quite simple solution to overcome this problem is to install & configure Nginx in front of Tomcat. Nginx is a free, open-source, high-performance HTTP server and provides reverse proxy. Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.
- You have installed & setup Apache Tomcat,
- You have installed Nginx,
- You have a domain http://xyz.com,
- Your grails app have static files under the path /webcontents/**,
- You have secure key & certificate for SSL.
- Nginx with Apache tomcat on grails,
- Serving static files with Tomcat,
- Secure connection (SSL),
- Redirecting all non http/www request to secure https connection,
- Redirecting any particular domain to another domain,
- Configuring sub domain processing,
- Masking some request parameter used by grails spring security core plugin.
File: /etc/nginx/nginx.conf (File path may depends on system)
Now Tomcat needs to be told that requests are proxied through secure layer (SSL) port 443. For this we need to set proxyPort to 443 in Tomcat server.config file. Find connector configuration to modify.
<Connector port=”8080” protocol=”HTTP/1.1” connectionTimeout=”20000” redirectPort=”8443” proxyName=”localhost” proxyPort=”443” />
About CauseCode: We are a technology company specializing in Healthtech related Web and Mobile application development. We collaborate with passionate companies looking to change health and wellness tech for good. If you are a startup, enterprise or generally interested in digital health, we would love to hear from you! Let's connect at firstname.lastname@example.org