CDN Proxy
Proxy rules can be configured to route traffic back to your origin server(s) while maintaining a cache in our edge content delivery network.
This is effectively a traditional CDN, however there are many additional options available such as static failover, header overrides, alert injection, image optimization, and web-application firewall.
Configuration overview
Section titled “Configuration overview”
- Proxy address: is your backend/origin server. This may be a FQDN or IP address and should include the protocol.
- Host header: should be a valid Host header to send to the origin server.
- Origin auth username and Origin auth password: provide these if the origin server is protected by basic authentication.
- Cache lifetime (seconds): optionally override the cache lifetime of the proxied response in Quant. Leave blank to inherit the cache headers sent by your backend server.
- Disable SSL verification: may be used if the server is using a self-signed (or other invalid) certificate.
- Only proxy on 404: will serve from the Quant static edge if content exists, else proxy.
- Failover mode: serves a static copy of the site when the origin fails. More detail below.
- Alert on origin error: adds the sitewide alert banner to the HTML responses of this rule. This can be useful to allow widespread alert messaging to be presented to end users without the need for application-level change.
You may use the wildcard captures in your proxies, simply include a capture value in the proxy address. For example: a match on /api/* with a proxy address: https://api.example.com/v1/$1.
The proxy address is used exactly as written. Quant does not add the request path for you, so https://origin.example.com sends every matched request to the origin’s /. To keep the request path, use https://origin.example.com$*. The query string is added automatically. See wildcard matches and captures.
Settings in detail
Section titled “Settings in detail”| Setting (API field) | Behaviour |
|---|---|
Host header (host) |
Sent to the origin. When empty, the visitor’s host name is sent |
Cache lifetime (cache_lifetime) |
A string, in seconds. Empty or -1: the origin’s Cache-Control header is kept. "0": Quant sets Cache-Control: no-store, so nothing is cached. A positive value such as "600": Quant sets Cache-Control: public, max-age=600 |
Origin timeout (origin_timeout) |
A string, in milliseconds. When unset, 30 seconds. "90" means 90 ms; use "90000" for 90 seconds |
Only on 404 (only_proxy_404) |
Quant serves its static content when the path exists, and proxies only when it does not. Proxied responses carry the header quant-404-proxied: true |
Request headers (inject_headers) |
Added to the request sent to the origin |
Strip headers (proxy_strip_headers, proxy_strip_request_headers) |
Removed from the response, or from the request sent to the origin |
Origin errors and the 502 Proxy Error page
Section titled “Origin errors and the 502 Proxy Error page”If the origin does not answer within the origin timeout, or the connection fails, Quant returns its own 502 page with the title Proxy Error and the text “An error occurred when communicating with a backend origin service.” This page comes from Quant, not from your origin.
- A request that timed out is not retried.
- After 10 failures within 10 seconds, Quant returns the
502for a short cool-down period without contacting the origin. With failover mode on, the rule switches to the static copy sooner: after the number of failures set in Failures before failover (3 by default). - To show your own page, turn on Static error page on the proxy rule, add
502to its Status codes, and publish a page at_quant502(see custom error pages).
Failover mode
Section titled “Failover mode”Failover mode keeps a site online when its origin fails, by serving the static copy of the site that is stored in the Quant project. Use it for outages. It is not a security control: while the origin answers normally, every request still goes to the origin.
To serve the static copy at set times whatever the origin does, for example every night or from the moment a critical CMS flaw is announced, add a schedule with Apply except during to the proxy rule.
Failover needs a static copy of the pages before the origin fails. Make the copy with the crawler, and schedule crawls to keep it current. During failover, a path that is not in the copy gets the Quant 404 page (or your custom 404 page).
Turn on Failover mode in the Failover section of the proxy rule, then set these fields:

| Field | Default | Behaviour |
|---|---|---|
| Origin TTFB threshold (ms) | 5000 | The origin timeout while failover mode is on. It replaces Origin timeout (ms) for this rule. From 1000 to 60000 |
| Failures before failover | 3 | How many failures within 10 seconds start failover. From 1 to 100. Set a higher value for an origin with occasional slow pages; set 1 to fail over on the first failure |
| Failover lifetime (s) | 300 | How long the rule serves the static copy after failover starts. From 60 to 86400 |
| Origin statuses that do not trigger failover | 200, 301, 302, 304, 404 | The statuses of a healthy origin. Any other origin status switches the rule to the static copy. The list cannot contain 500 or 502 |
The rule switches to the static copy when the origin fails the number of times set in Failures before failover (3 by default) within 10 seconds. One slow page or one error does not switch the whole rule. A failure is one of these:
- The origin answers with a status that is not in Origin statuses that do not trigger failover.
- The connection to the origin fails (refused, reset, DNS or TLS error).
- The origin sends no first byte within Origin TTFB threshold (ms).
All failures of the rule count together, whatever their kind. Before the count is reached, a request with a bad status gets the origin’s response, and a request with a connection error or a timeout gets the Quant 502 page. The request that reaches the count gets the static copy, and the rule stays on the static copy for the failover lifetime.
While failover is active:
- The rule does not contact the origin until Failover lifetime (s) ends. The next request after that goes to the origin again.
- Each response comes from the static copy, with the header
quant-failover: trueandCache-Control: s-maxage=set to the failover lifetime. - Failover applies to one rule only, and to each edge region on its own. One region can serve the static copy while another region still proxies to the origin.
Because the static responses carry s-maxage, the edge can keep serving them for the failover lifetime. After the origin recovers, purge the affected paths.
Request headers
Section titled “Request headers”You may optionally inject extra request headers to your origin server. This is useful to provide an extra layer of security, e.g: pass a shared key back to your origin server to protect direct origin server access.

You may also optionally strip response headers. This is useful to exclude certain origin headers from the response sent back to your end users. For example, this may be useful for excluding headers that contain mention of versions of software running on your origin server to improve security posture.

