Nginx Proxy Guard

Features

Redirect hosts

A redirect host answers requests for its domains with a redirect (301, 302, 307 or 308) instead of forwarding them to a backend. Use it to move an old domain to a new one, or to send the bare domain to the www address.

Where to create one

Open Redirects in the top menu and click Add Redirect. The list shows the source domains, the target, the code and the status.

Redirect host list and edit dialog
Redirect host list and edit dialog

Settings

FieldMeaningDefault
Domain Names (one per line)The source domains to redirectnone
SchemeThe protocol of the target address. Auto keeps the protocol the request came in with (http or https).Auto
Target DomainHostname or IP to redirect to. A port can be added, as in :8443.none
Redirect Code301 (Permanent), 302 (Found), 307 (Temporary), 308 (Permanent)301
Forward PathA path appended after the target domain. Must start with /.empty
Preserve original pathAppends the request's path and query string to the target address.on
Enable SSLAccepts HTTPS on the source domains. Choose the certificate under Select Certificate.off
Force HTTPSHTTP requests to a source domain are first sent to HTTPS on the same domain.off
EnabledWhen off, this redirect is left out of the nginx configuration.on
Block ExploitsBlocks known attack patterns (the exploit block rules).off

How the target address is built

The target is scheme://target domain + forward path + (when Preserve original path is on) the request path.

RequestSettingsLocation in the response
https://old.example.com/blog?p=1Scheme Auto, target new.example.com, preserve path onhttps://new.example.com/blog?p=1
http://old.example.com/blogScheme HTTPS, target new.example.com, forward path /archive, preserve path onhttps://new.example.com/archive/blog
https://old.example.com/anythingScheme HTTPS, target new.example.com, preserve path offhttps://new.example.com

The forward path and the original path are joined as they are, so do not end the forward path with /.

HTTPS

  • With Enable SSL on and a certificate chosen, the source domains also accept HTTPS. Issue the certificate first under SSL certificates.
  • A redirect host with SSL also answers over HTTP/2 and HTTP/3 (QUIC). There is no separate toggle.
  • If no certificate is assigned or its files do not exist yet, the configuration is HTTP-only until they do.
  • /.well-known/acme-challenge/ on the source domains is answered by NPG instead of being redirected, so Let's Encrypt HTTP-01 issuance and renewal work.

Interaction with other features

  • The WAF does not apply to redirect hosts, and they have none of the Security tab features such as GeoIP restriction, access lists or the bot filter. Block Exploits is the only protection you can turn on.
  • The global Fail2ban does not count requests for domains configured as redirect hosts.
  • A certificate used by a redirect host cannot be deleted; unassign it from the redirect host first.
  • Sync All Configs in the top bar regenerates the redirect hosts as well.

Limits

  • There are no per-path redirect rules; a host sends everything to one target. For per-path redirects, write location and return on the Advanced tab of a proxy host.
  • The target domain cannot contain a wildcard.
  • The forward path cannot contain whitespace, ;, {, }, $, quotes or backslashes.