Caddy directive/variable for Reverb proxy #609
Replies: 1 comment
-
|
This is a great feature request! As Reverb becomes standard in the Laravel ecosystem, needing to intercept those specific paths before the main PHP handler is going to be a common requirement. Until a Instead of relying on the environment variable injection, you can mount your own configuration that handles the Reverb paths first, and then falls back to the standard logic. 1. Create a :80 {
# 1. Handle Reverb requests first
@reverb {
path /app/* /apps/*
}
handle @reverb {
reverse_proxy reverb:8080
}
# 2. Fallback to the standard PHP server logic
# This includes the default fastcgi and file_server configurations
import php_server
# Optional: Include any other extra directives if you still use the ENV
{$CADDY_SERVER_EXTRA_DIRECTIVES}
}
2. Mount it in your services:
php:
image: serversideup/php:8.3-fpm-caddy
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
# ... other config
This ensures your Reverb proxy is always evaluated before the request gets handed off to Laravel/PHP. Hope that unblocks you! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The Problem
Laravel Reverb requires requests to /app/* and /apps/* to be reverse-proxied to the Reverb container.
The existing CADDY_SERVER_EXTRA_DIRECTIVES environment variable cannot be used for this because it's positioned after php_server in the Caddyfile.
The following code must be placed BEFORE the root directive in the Caddyfile. This could be done with an environment variable, like REVERB_PROXY or REVERB_CONTAINER.
The advantage is that it avoids us having a subdomain exclusively for Reverb.
@reverb { path /app/* /apps/* } handle @reverb { reverse_proxy reverb:8080 }Beta Was this translation helpful? Give feedback.
All reactions