orbloC_J
(orbloC J)
April 2, 2023, 9:15pm
1
1. The problem I’m having:
I have two different servers with the same application on it and i would like to know if it is possible to set a server as primary and if that server is down it should go to anther server. But only if the first one dont answer.
2. Error messages and/or full log output:
Not applicable
3. Caddy version:
v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=
4. How I installed and ran Caddy:
I’m running windows command prompt
a. System environment:
Win10 64bit
b. Command:
caddy.exe run
c. Service/unit/compose file:
Not applicable
d. My complete Caddy config:
play.anonymus.se {
encode gzip
reverse_proxy localhost:8096
}
download.anonymus.se {
encode gzip
reverse_proxy localhost:5055
}
Really don’t want anyone to get my domain and i guess in this question it is not important?
5. Links to relevant resources:
1 Like
Yep, see the docs about load balancing: reverse_proxy (Caddyfile directive) — Caddy Documentation
You’re looking for lb_policy first
. Configure multiple upstreams for reverse_proxy
, and Caddy will use the first healthy one. Make sure to enable retries, and/or active/passive health checking so that Caddy can determine when the first one is down.
orbloC_J
(orbloC J)
April 6, 2023, 1:41am
3
Would it look something like this?
And will the health check just check for a non 404 or do i need to specify any specific page or samething?
encode gzip
reverse_proxy localhost:8096 192.168.86.65:8096{
lb_policy first
health_interval 10s
}
Make sure to have a space before the {
, this is important. Whitespace is significant in the Caddyfile.
orbloC_J:
health_interval 10s
This alone won’t enable active health checks. You need to set health_uri
at least, for active health checks. The docs explain.
system
(system)
Closed
May 6, 2023, 5:14am
5
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.