Reverse proxy for more than one domain name error


(LIlei) #1

As shown in the figure, how to avoid a user’s access to load once, and go through a reverse proxy. What is shown on the map is staggered. Often leads to errors. Give me a demo, thank you


(Matthew Fay) #2
  • to is the destination endpoint to proxy to. At least one is required, but multiple may be specified. If a scheme (http/https/quic/srv) is not specified, http is used. Unix sockets may also be used by prefixing “unix:”. QUIC connections are experimental, but to try it, just use “quic://” for the scheme. Service discovery using SRV lookup is supported. If the endpoint starts with srv:// or srv+https:// it will be considered as a service locator and Caddy will attempt to resolve available services via SRV DNS lookup.
  • policy is the load balancing policy to use; applies only with multiple backends. May be one of random, least_conn, round_robin, first, ip_hash, uri_hash, or header. If header is chosen, the header name must also be provided. Default is random. This setting is not applicable if destination is a service locator.

https://caddyserver.com/docs/proxy

From these parts of the proxy documentation, we know that multiple proxy upstreams will be, by default, randomly selected for each request.

So, by proxying to https://nginx.org/ and https://caddyserver.com, when you browse to the site, half the assets will be loaded from the former, and half from the latter. This is probably not what you want to achieve.


(system) #4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.