Skip to content

Feature request: Reverse Proxy with Caddy #2982

Description

@Gill-Bates

I want to share my Caddy Config for adding it into the Repo.

This Config works only with Websocket-Configuration!

Image

Image

/etc/caddy/Caddyfile

vpn.example.com {

    encode gzip

    # TLS 1.3 mandatory!
    tls {
        protocols tls1.3
    }

    # Protect your GUI with Basic Auth
    route /admin* {
        basic_auth {
            admin ******
        }
        reverse_proxy xx.xx.xx.xx:2053
    }

    # Obfuscate the Endpoint
    route /api/v1* {
        @websockets {
            header Connection *Upgrade*
            header Upgrade websocket
        }
        reverse_proxy @websockets xx.xx.xx.xx:54321
        respond "Forbidden" 403
    }

    # Security Header
    header {
        header_up Authorization { >Authorization }
        header_up Content-Type { >Content-Type }
        Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
        X-Content-Type-Options nosniff
        X-Frame-Options SAMEORIGIN
        Referrer-Policy strict-origin-when-cross-origin
        -Server
        -X-Powered-By
    }

    # Fallback
    respond "Not found!" 404
}

Describe the solution you'd like

What is happening here?

  • Requesting vpn.example.com will end up in 404 Not found
  • The GUI-Portal (Basic Auth protected) is available with vpn.example.com/admin
  • The Endpoint is obfuscated with vpn.example.com/api/v1
  • Only Websocket-Connection are allowed. All other requests ends up in 403 Forbidden

Describe alternatives you've considered

No response

Checklist

  • This feature report is written entirely in English.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions