Comments (7)
There's no such thing as global HTTP routes in Caddy. All HTTP routes must go within a site block.
from caddy-docker-proxy.
Yes, to add additional plugins you need to write your own Dockerfile. See the README for an example. https://github.com/lucaslorentz/caddy-docker-proxy?tab=readme-ov-file#custom-images
from caddy-docker-proxy.
Hi @francislavoie, I build my own image and I can see that is successfully build with this module.
(Here you can my Dockerfile: #626 (comment))
If I run locally my setup with a static defined route it works fine:
This is my Caddyfile for my local setup:
{
auto_https off
order rate_limit before basicauth
}
:80
rate_limit {
distributed
zone dynamic_global {
key {remote_host}
window 60s
events 75
}
}
whoami.example.com:80 {
reverse_proxy 172.22.0.3:80
}
But if I want to use this in production with the caddy-docker-proxy container "discovery" functionality with labels it is not working.
Dockerfile for production:
{
order rate_limit before basicauth
}
:80
rate_limit {
distributed
zone dynamic_global {
key {remote_host}
window 60s
events 75
}
}
And is an example service with my labels
...
labels:
caddy: "www.example.com"
caddy.log:
caddy.reverse_proxy: "{{upstreams 8000}}"
caddy.encode: "gzip"
...
Have you or someone else ever successfully used caddy-docker-proxy with the rate-limit plugin?
(https://github.com/mholt/caddy-ratelimit)
from caddy-docker-proxy.
Rate limit is a directive so it must go within a site block. You can't put it top level, otherwise Caddy will parse it as a site address. If you have two sites, then braces are required. If you use labels, then rate_limit is just another directive, like reverse_proxy etc.
from caddy-docker-proxy.
@francislavoie
So I can not set a global rate limit for all https calls? I need to add it to all container manually with labels?
from caddy-docker-proxy.
Rate limit is a directive so it must go within a site block.
This is what you mean correct? To add it separately in each docker compose over labels?
Can you confirm that it is not possible to add a global rate limit for all containers/services in the main Caddyfile?
version: '3.7'
services:
whoami:
image: traefik/whoami
networks:
- caddy
labels:
caddy: "whoami.example.com"
caddy.reverse_proxy: "{{upstreams 80}}"
caddy.tls: "internal"
caddy.rate_limit.distributed:
caddy.rate_limit.zone: "dynamic_global"
caddy.rate_limit.zone.key: "{remote_host}"
caddy.rate_limit.zone.window: "1s"
caddy.rate_limit.zone.events: "1"
networks:
caddy:
external: true
from caddy-docker-proxy.
@francislavoie Thank you!
from caddy-docker-proxy.
Related Issues (20)
- wildcard not working HOT 2
- IPv6 Logging not working HOT 2
- Caddy 2.8 Final Release HOT 2
- Trouble with generic logging snippet import HOT 2
- Expose caddy admin 2019
- Custom images HOT 2
- How to local test caddy with whoami HOT 1
- Changing HTTP status code rewrite - is that possible using labels? HOT 1
- Simple redirect to custom 404.html (static site)
- Global options seems not working in caddy-docker-proxy itself HOT 1
- basic_auth label is still being written to caddyfile as basicauth which spams logs HOT 2
- Using the upstreams template in a snippet with arguments
- caddy-docker-proxy as file server ? HOT 1
- Is it possible to inject directives in an existing service? HOT 4
- Using CDP as a reverse proxy for non-docker services - is it possible? HOT 1
- How to enable caddy-docker-proxy in a new build? HOT 2
- Help to convert a snippet to labels HOT 9
- Searxng-docker Caddyfile Conversion Help HOT 1
- Usage example results in TLSv1 internal error HOT 7
- Upstream from a Dev Container gives "Container is not in same network as caddy"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caddy-docker-proxy.