A reverse proxy sits between the internet and your Email Tracker Node.js server, handling TLS termination and forwarding requests.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/shlokjain2031/email-tracker-extension/llms.txt
Use this file to discover all available pages before exploring further.
Architecture
- Listens on ports 80 (HTTP) and 443 (HTTPS)
- Obtains and manages SSL/TLS certificates
- Terminates HTTPS connections
- Forwards requests to the Node.js server on localhost
Configuration examples
Both configurations below are production-ready and come from the Email Tracker repository.- Caddy
- Nginx
Caddy automatically obtains and renews Let’s Encrypt certificates. This is the simplest option.Replace Caddy will automatically:Test the configuration:
Install Caddy
Caddyfile configuration
Create or edit/etc/caddy/Caddyfile:email-tracker.duckdns.org with your domain.Start Caddy
- Obtain a Let’s Encrypt certificate for your domain
- Redirect HTTP to HTTPS
- Renew certificates before expiration
- Proxy requests to your Node.js server
Verify configuration
Check Caddy status:Configuration details
Port forwarding
Both configurations:- Listen on port 443 for HTTPS traffic
- Forward requests to
127.0.0.1:8090(your Node.js server) - The Node.js server only needs to listen on localhost
HTTP to HTTPS redirect
- Caddy: Automatic redirect from HTTP to HTTPS
- Nginx: Explicit
return 301in the port 80 server block
Compression
- Caddy:
encode gzipcompresses responses - Nginx: Add
gzip on;to enable compression (optional)
Headers forwarded to Node.js
The Nginx configuration forwards important headers:Host: Original domain nameX-Real-IP: Client’s IP addressX-Forwarded-For: Full proxy chainX-Forwarded-Proto: Original protocol (https)
Testing your setup
1. Check TLS certificate
- Certificate is valid
- Issuer is Let’s Encrypt (or your CA)
- Not expired
2. Test HTTP redirect
301 Moved Permanently with Location: https://...
3. Test HTTPS endpoint
{"status":"ok"}
4. Test tracking pixel
200 OK with content-type: image/gif
Troubleshooting
Certificate errors
Problem: Browser shows “Your connection is not private” Solutions:- Verify DNS points to correct server
- Check certificate was obtained for correct domain
- Ensure certificate files exist at specified paths
- Restart reverse proxy service
502 Bad Gateway
Problem: Nginx/Caddy returns 502 error Solutions:- Verify Node.js server is running:
curl http://127.0.0.1:8090/health - Check port number matches in reverse proxy config and Node.js
- Review reverse proxy error logs
- Ensure no firewall blocking localhost connections
Certificate renewal fails
Problem: Let’s Encrypt certificate expires Solutions:- Ensure ports 80 and 443 are accessible from internet
- Check DNS points to correct server
- Review Certbot/Caddy logs for renewal errors
- Manually renew:
sudo certbot renew(Nginx) orsudo systemctl restart caddy(Caddy)
Advanced configuration
Rate limiting
Protect your server from abuse:- Caddy
- Nginx
Custom SSL settings
For stricter security or compatibility:Next steps
- Complete production setup verification steps
- Review operational recommendations
- Set up monitoring and backups