{"id":20347494,"url":"https://github.com/anycable/caddy-anycable","last_synced_at":"2025-08-13T20:06:43.865Z","repository":{"id":241866805,"uuid":"787928420","full_name":"anycable/caddy-anycable","owner":"anycable","description":"AnyCable module for Caddy","archived":false,"fork":false,"pushed_at":"2024-07-02T17:59:17.000Z","size":117,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-08-08T05:49:22.509Z","etag":null,"topics":["anycable","caddy","caddy-plugin","rails","websockets"],"latest_commit_sha":null,"homepage":"https://anycable.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anycable.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-17T12:59:52.000Z","updated_at":"2025-01-11T03:02:59.000Z","dependencies_parsed_at":"2024-11-14T22:16:52.878Z","dependency_job_id":null,"html_url":"https://github.com/anycable/caddy-anycable","commit_stats":null,"previous_names":["evilmartians/caddy_anycable","anycable/caddy-anycable"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anycable/caddy-anycable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anycable%2Fcaddy-anycable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anycable%2Fcaddy-anycable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anycable%2Fcaddy-anycable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anycable%2Fcaddy-anycable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anycable","download_url":"https://codeload.github.com/anycable/caddy-anycable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anycable%2Fcaddy-anycable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270305183,"owners_count":24562087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anycable","caddy","caddy-plugin","rails","websockets"],"created_at":"2024-11-14T22:16:55.432Z","updated_at":"2025-08-13T20:06:43.798Z","avatar_url":"https://github.com/anycable.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CaddyAnyCable Module\n\n## Overview\n\nThe CaddyAnyCable module integrates AnyCable with Caddy v2, enabling Caddy to handle WebSocket connections for [AnyCable](https://docs.anycable.io/) and proxy them to the AnyCable server. \n\nThis is particularly useful for Ruby on Rails applications utilizing AnyCable for WebSocket connections in a production environment.\n\n[Caddy](https://github.com/caddyserver/caddy) is a modern, open-source web server with a modular architecture that serves HTTP, HTTPS, and automatically obtains and renews TLS certificates.\n\n[AnyCable](https://docs.anycable.io/) provides a more efficient way to handle WebSocket connections in Ruby on Rails applications, allowing you to offload WebSocket handling from your Rails application server to AnyCable-Go.\n\n\n## Installation\n\nTo use this module, you must build Caddy with the AnyCable module included. This typically involves using `xcaddy` to custom build Caddy:\n\n1. **Install `xcaddy`:**\n   Follow the xcaddy [documentation](https://github.com/caddyserver/xcaddy?tab=readme-ov-file#install) for installation instructions.\n2. **Compile Caddy with the `caddy-anycable` module:**\n   Run the following command to build Caddy with the AnyCable module:\n\n   ```bash\n   xcaddy build --with github.com/evilmartians/caddy_anycable\n   ```\n   This command will compile a caddy binary file that includes the AnyCable module.\n3. **Place the compiled Caddy binary and the Caddyfile in the same directory:**\n   Move the compiled caddy binary file and your Caddyfile to the desired directory. \n4. **Run Caddy with the Caddyfile:**\n   If there is a file called Caddyfile in the current directory and no other configuration is specified, Caddy will load the Caddyfile, adapt it, and run it right away. Execute the following command to start Caddy:\n   \n   ```bash\n   ./caddy run\n   ```\n   \n   If your Caddyfile is located in a different directory, you can specify the path:\n   ```bash\n   ./caddy run --config /path/to/Caddyfile\n   ```\n\nThis process ensures that Caddy is running with the `AnyCable` module, and it will handle WebSocket connections as configured in your Caddyfile.\n\n## Configuration\n\n### Caddyfile Syntax\n\nThe Caddyfile syntax for configuring the AnyCable module is as follows:\n\n```caddyfile\nanycable {\n    log_level \u003clevel\u003e\n    redis_url \u003curl\u003e\n    http_broadcast_port \u003cport\u003e\n}\n```\n\n- **log_level**: Sets the log level for AnyCable (e.g., debug, info, warn, error).\n- **redis_url**: Specifies the URL of the Redis server used by AnyCable.\n- **http_broadcast_port**: Defines the port for HTTP broadcasting.\n\nRefer to the [AnyCable Configuration Documentation](https://docs.anycable.io/anycable-go/configuration) for additional configuration options.\n\nIn the anycable section of your Caddyfile, configure the settings directly corresponding to AnyCable configuration options, without the `--` prefix typically used in command-line settings.\n\nYou can enable [SSE mode](https://docs.anycable.io/anycable-go/sse) by adding the sse option to the block:\n\n```caddyfile\n   anycable {\n      log_level \u003clevel\u003e\n      redis_url \u003curl\u003e\n      http_broadcast_port \u003cport\u003e\n      sse true\n   }\n```\n\nYou can also change the [WebSocket's path](https://docs.anycable.io/anycable-go/configuration?id=primary-settings) and [SSE's path](https://docs.anycable.io/anycable-go/sse?id=configuration) by setting the `path` and `sse_path` options in the block.\nThe default websocket path is `/cable`. The default SSE path is `/events`.\n\n### Full example\n\nBelow is a complete example of a Caddyfile that integrates AnyCable:\n\n```caddyfile\n{\n    order anycable before reverse_proxy\n}\n\nhttp://localhost:3000 {\n    root * ./public\n    @notStatic {\n        not {\n            file {\n                try_files {path}\n            }\n        }\n    }\n\n    reverse_proxy @notStatic {\n        to localhost:3100\n\n        header_up X-Real-IP {remote_host}\n        header_up X-Forwarded-Proto {scheme}\n        header_up Access-Control-Allow-Origin *\n        header_up Access-Control-Allow-Credentials true\n        header_up Access-Control-Allow-Headers Cache-Control,Content-Type\n        transport http {\n            read_buffer 8192\n        }\n    }\n\n    anycable {\n        broadcast_adapter http\n        presets broker\n        rpc_host http://localhost:3100/_anycable\n        log_level debug\n    }\n\n    file_server\n}\n```\n\nThis Caddyfile sets up a proxy server on port 3000, which proxies requests to the backend server on port 3100. \nIt also configures an AnyCable server that listens for WebSocket connections at the `/cable` URL.\n\n\n## Usage\nOnce configured, start Caddy with the Caddyfile. AnyCable-Go will handle WebSocket connections at the path `/cable`, and other requests will be managed according to other directives in your Caddyfile.\n\nFor further information on configuration and options, refer to the [AnyCable documentation](https://docs.anycable.io/anycable-go/configuration)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanycable%2Fcaddy-anycable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanycable%2Fcaddy-anycable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanycable%2Fcaddy-anycable/lists"}