# Secure Pangolin Integration with Traefik(Rick and roll)

**URL:** <https://forum.hhf.technology/t/secure-pangolin-integration-with-traefik-rick-and-roll/461>\
**Category:** Networking\
**Tags:** traefik, tunnels, pangolin\
**Created:** [February 9, 2025, 3:58pm UTC](https://forum.hhf.technology/t/secure-pangolin-integration-with-traefik-rick-and-roll/461 "2025-02-09T15:58:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [February 9, 2025, 3:58pm UTC](https://forum.hhf.technology/t/secure-pangolin-integration-with-traefik-rick-and-roll/461/1 "2025-02-09T15:58:27Z")

</div>

# Secure Pangolin Integration with Traefik

## Overview

This guide covers setting up Pangolin with Traefik, including comprehensive security measures like CrowdSec integration, malicious request blocking, and proper header management.

## Configuration Components

### Basic Traefik Setup

```yaml
http:
  middlewares:
    # Basic HTTPS redirection
    redirect-to-https:
      redirectScheme:
        scheme: https

    # Internal network whitelist
    default-whitelist:
      ipWhiteList:
        sourceRange:
        - "10.0.0.0/8"
        - "192.168.0.0/16"
        - "172.16.0.0/12"

```

### Security Headers

Essential security headers to protect against common web vulnerabilities:

```yaml
    security-headers:
      headers:
        customResponseHeaders:
          Server: ""
          X-Powered-By: ""
          X-Forwarded-Proto: "https"
        sslProxyHeaders:
          X-Forwarded-Proto: "https"
        hostsProxyHeaders:
          - "X-Forwarded-Host"
        contentTypeNosniff: true
        customFrameOptionsValue: "SAMEORIGIN"
        referrerPolicy: "strict-origin-when-cross-origin"
        forceSTSHeader: true
        stsIncludeSubdomains: true
        stsSeconds: 63072000
        stsPreload: true
        browserXssFilter: true

```

### Malicious Request Protection

Redirects potential attack attempts to a Rick Roll video:

```yaml
    security-redirects:
      redirectRegex:
        permanent: false
        regex:
          - "^.*/wp-.*"
          - "^.*\.(php|asp|aspx|jsp|cgi|sql|sqlite|sq3|sh)$"
          - "^.*(administrator|phpmyadmin|myadmin|mysql|wp|xmlrpc|Autodiscover|console).*"
          - "^.*(\.env|\.git|\.svn|\.hg|\.DS_Store|wp-config\.php|web\.config|.htaccess).*"
          - "^.*(nmap|nikto|sqlmap|xerosploit|slowloris|shell|backdoor|hack).*"
        replacement: "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

```

### Router Configuration

Setting up routes for different components:

```yaml
  routers:
    # HTTPS redirect
    main-app-router-redirect:
      rule: "Host(`your-domain.com`)"
      service: next-service
      entryPoints:
        - web
      middlewares:
        - redirect-to-https

    # Next.js application
    next-router:
      rule: "Host(`your-domain.com`) && !PathPrefix(`/api/v1`)"
      service: next-service
      entryPoints:
        - websecure
      middlewares:
        - security-headers
        - security-redirects
      tls:
        certResolver: letsencrypt

    # API endpoints
    api-router:
      rule: "Host(`your-domain.com`) && PathPrefix(`/api/v1`)"
      service: api-service
      entryPoints:
        - websecure
      middlewares:
        - security-headers
        - security-redirects
      tls:
        certResolver: letsencrypt

```

### Service Definitions

Backend service configuration:

```yaml
  services:
    next-service:
      loadBalancer:
        servers:
          - url: "http://pangolin:3002"

    api-service:
      loadBalancer:
        servers:
          - url: "http://pangolin:3000"

```

## Implementation Steps

1. **Prerequisites**

2. **Configuration File Setup**

3. **Security Measures**

4. **Validation**

## Maintenance and Monitoring

1. **Regular Updates**

2. **Monitoring**

3. **SSL Certificate Management**

## Best Practices

1. **Security**

2. **Performance**

3. **Maintenance**

---

<div class="post-metadata">

**Author:** ![nghialele](https://forum.hhf.technology/user_avatar/forum.hhf.technology/nghialele/32/3904_2.png) [@nghialele](https://forum.hhf.technology/u/nghialele)\
**Post date:** [November 1, 2025, 2:13pm UTC](https://forum.hhf.technology/t/secure-pangolin-integration-with-traefik-rick-and-roll/461/2 "2025-11-01T14:13:11Z")

</div>

Thank you for sharing, this is very useful.

My approach is taking this over to my Coolify setup too, not just my Pangolin one.

---

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [November 1, 2025, 2:26pm UTC](https://forum.hhf.technology/t/secure-pangolin-integration-with-traefik-rick-and-roll/461/3 "2025-11-01T14:26:57Z")

</div>

have fun with this, this comes from my old nginx deployment.

---

<div class="post-metadata">

**Author:** ![nghialele](https://forum.hhf.technology/user_avatar/forum.hhf.technology/nghialele/32/3904_2.png) [@nghialele](https://forum.hhf.technology/u/nghialele)\
**Post date:** [November 2, 2025, 12:55am UTC](https://forum.hhf.technology/t/secure-pangolin-integration-with-traefik-rick-and-roll/461/4 "2025-11-02T00:55:22Z")

</div>

Bro your username missing a ‘g’ 😄

---

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [November 2, 2025, 9:41am UTC](https://forum.hhf.technology/t/secure-pangolin-integration-with-traefik-rick-and-roll/461/5 "2025-11-02T09:41:19Z")

</div>

I know. It’s from day one. It’s a good omen.
