Skip to content

**Feature Request: Add UDP and TCP proxy support alongside existing HTTP/HTTPS** #16

@nglmercer

Description

@nglmercer

Problem

Description

Slim currently only supports HTTP/HTTPS protocols with WebSocket support. This feature request aims to extend Slim's capabilities to include generic TCP and UDP proxying, making it a more versatile local development tool.

Current State

Slim is designed as an HTTP/HTTPS reverse proxy for local development . It supports:

  • HTTP/HTTPS with automatic redirects
  • HTTP/2.
  • WebSocket via HTTP upgrade
  • TCP as underlying transport only

Technical Considerations

  • Architecture: Need to extend proxy.Server struct to handle TCP/UDP listeners
  • Port Forwarding: Current iptables/pfctl rules only handle TCP
  • Certificate Management: TLS certificates not needed for raw TCP/UDP
  • Logging: Extend access logging for TCP/UDP connections

Use Cases

  • Database proxying (MySQL, PostgreSQL on TCP)
  • DNS server development (UDP)
  • Game server development (UDP)
  • Microservices with non-HTTP protocols

Proposed Solution

1. TCP Proxy Support

  • Add TCP listener alongside existing HTTP servers
  • Implement raw TCP connection forwarding
  • Extend configuration to support TCP routes
  • Modify port forwarding rules to handle arbitrary TCP ports

2. UDP Proxy Support

  • Add UDP packet forwarding capabilities
  • Implement UDP connection tracking for stateless proxying
  • Handle UDP-specific challenges (connection tracking, timeouts)

3. Configuration Extension

Extend .slim.yaml to support:

domains:
  - domain: myapp
    port: 3000
    tcp_routes:
      - port: 3306
        target: localhost:3307
    udp_routes:
      - port: 53
        target: localhost:8053

Alternatives Considered

No response

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