Skip to content

SSL Termination with Caddy for Martini Server Runtime

Caddy serves as an efficient reverse proxy for your Martini Server Runtime, enabling SSL termination with ease. This guide shows you how to leverage Caddy’s automatic HTTPS feature using Let's Encrypt to secure your web applications. By managing SSL certificates and forwarding HTTPS traffic seamlessly, you can enhance your application's security with minimal setup.

Prerequisites

  • Caddy: Ensure you have Caddy installed on your server.

Configuration

Assuming you have Caddy installed and have your DNS configured you may follow the steps below to configure SSL Termination. Make sure to replace placeholders your-domain.com to your actual domain name.

1. Create a Caddyfile

Create a Caddyfile in a suitable location, e.g., /etc/caddy/Caddyfile:

1
sudo nano /etc/caddy/Caddyfile

2. Add the following configuration to handle SSL termination and reverse proxy to Martini Server Runtime

This configuration assumes Martini Server Runtime is running on the same machine and using the default port localhost:8080.

1
2
3
your-domain.com {
    reverse_proxy localhost:8080
}

3. Restart Caddy

After making the configuration changes, restart Caddy to apply them:

1
sudo systemctl restart caddy

4. Start Martini Runtime

If Martini Runtime is not already running, start it.

5. Verify

Visit https://your-domain.com in your web browser to verify that your configuration is working.

Additional Security Settings

You may want to add some security headers or tweak your SSL settings. Here’s a basic example:

1
2
3
4
5
6
your-domain.com {
    reverse_proxy localhost:8080
    header {
        Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
    }
}

To know more about headers refer to Caddy documentation: Headers