ℹ️ This page contains an example of a configuration file for the redirection.io agent. To discover all the configuration file and its options, please refer to the agent configuration reference. You may also check the list of configuration examples to find a configuration example that is close to your technical context.

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 at 127.0.0.1:8080, whatever the domain name
  • when a request is received on port 443, it depends. If it is received for the domain media.example.com, it is forwarded to the local filesystem at /var/www/media. Else, it is routed to the default backend at 127.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.