Virtualhosts with per-domain behavior
This example defines a default reverse proxy configuration and two virtual_hosts: one for website domains (example.com and www.example.com), with a dedicated project key (WEBSITE_PROJECT_KEY), and one domain for the media files (media.example.com), only accessible through TLS, for serving a local directory with its own project key (MEDIA_PROJECT_KEY).
In this example, the agent listens on ports 80 and 443
- when a request arrives on port
80, it is routed to the default backend at127.0.0.1:8080, whatever the domain name - when a request is received on port
443, it depends. If it is received for the domainmedia.example.com, it is forwarded to the local filesystem at/var/www/media. Else, it is routed to the default backend at127.0.0.1:8080.
This example demonstrates host-based overrides for forwarding settings: while the first virtualhost uses the default forwarding address (127.0.0.1:8080), the "media" virtualhost overrides this configuration.