Skip to content

[Feature]: Add Support for Caddy as an Alternative Reverse Proxy #14

@Harmeet10000

Description

@Harmeet10000

Prerequisites

  • I have searched the existing issues to avoid duplicates
  • I understand that this is just a suggestion and might not be implemented

Problem Statement

Currently, the project primarily uses Nginx as the reverse proxy for production deployments (as per the deployment docs). While Nginx is solid, users coming from simpler setups (or those preferring automatic HTTPS handling) might benefit from an alternative like Caddy. This would make the project more accessible, especially for solo devs or quick Docker-based deploys, without losing the battle-tested Nginx option.
As someone familiar with Nginx configs, I found Caddy's syntax to be a near-drop-in replacement but with less boilerplate (e.g., auto-Let's Encrypt). It would be great to have it as an officially supported option in the docs or Docker Compose examples.

Proposed Solution

  • Update Deployment Docs: Add a new section in docs/deployment.md (or similar) covering Caddy setup, including a basic Caddyfile example tailored to our FastAPI app (running on Uvicorn at localhost:8000).
  • Docker Integration: Include an optional docker-compose.yml override or example using Caddy as the proxy service (e.g., via the official Caddy image).
  • Config Example: Provide a sample Caddyfile like:
textyourdomain.com {
    reverse_proxy localhost:8000 {
        header_up Host {host}
        header_up X-Real-IP {remote}
        header_up X-Forwarded-For {remote}
        header_up X-Forwarded-Proto {scheme}
    }
    handle /static/* {
        root * /app/static  # Adjust path as needed
        file_server
    }
}
  • Migration Notes: Briefly compare to Nginx (e.g., "Similar to proxy_pass but with implicit HTTPS").
  • Testing: Add a simple smoke test or CI step to verify Caddy proxying works in a dev environment.

This keeps Nginx as the default but adds flexibility.

Alternatives Considered

  • Stick with Nginx only: Fine, but limits onboarding for non-ops folks.
  • Traefik: More dynamic (great for microservices), but overkill here and less familiar if someone's used to static configs like Nginx.
  • No proxy: Not production-ready for FastAPI.

Additional Context

  • Project: langchain-fastapi-production
  • Environment: Likely Docker-based, Ubuntu/Debian host.
  • Related: We've discussed this in [link to chat if applicable], and Caddy's lightweight nature aligns with FastAPI's async focus.

Thanks for considering! Happy to help test or contribute the PR. 🚀

Priority

Medium

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions