Apache¶
These complete configurations require a valid Trident Core licence at
/etc/trident/license.key, readable by the service user. The explicit
license.path below selects that file; mounting a licence without configuring
its path does not activate caching. A successful --check validates the
configuration, not the entitlement. Verify licensed runtime status and a
cacheable MISS followed by HIT with identical complete bodies.
Architecture 1: Apache in Front of Trident¶
Apache handles TLS and forwards all requests to Trident. Trident caches responses from your backend.
Required Modules¶
Enable the necessary Apache modules:
Apache Configuration¶
<VirtualHost *:443>
ServerName example.com
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
ProxyPreserveHost On
ProxyAddHeaders Off
RequestHeader set Host "example.com:443"
RequestHeader set X-Forwarded-Host "example.com:443"
ProxyPass / http://127.0.0.1:8120/
ProxyPassReverse / http://127.0.0.1:8120/
RequestHeader set X-Real-IP "expr=%{REMOTE_ADDR}"
RequestHeader set X-Forwarded-For "expr=%{REMOTE_ADDR}"
RequestHeader set X-Forwarded-Proto "https"
RequestHeader unset Forwarded
RequestHeader unset X-Forwarded-Port
RequestHeader unset X-Scheme
RequestHeader unset X-Forwarded-Ssl
RequestHeader unset X-Forwarded-Scheme
RequestHeader unset X-Url-Scheme
RequestHeader unset X-Forwarded-Protocol
RequestHeader unset CloudFront-Forwarded-Proto
RequestHeader unset Front-End-Https
RequestHeader unset X-Forwarded-Server
</VirtualHost>
<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com/
</VirtualHost>
Trident Configuration¶
{
"license": {
"path": "/etc/trident/license.key"
},
"server": {
"listeners": [
{
"address": "127.0.0.1:8120"
}
],
"preserve_host": true
},
"backends": [
{
"name": "origin",
"host": "127.0.0.1",
"port": 8080
}
],
"security": {
"trusted_proxies": [
"127.0.0.1/32"
]
},
"cache": {
"poisoning": {
"known_hosts": [
"example.com",
"example.com:443"
]
}
},
"admin": {
"address": "127.0.0.1:6085",
"auth_token": "${TRIDENT_ADMIN_TOKEN}"
}
}
Bind to localhost
When Apache sits in front, bind Trident to 127.0.0.1:8120 instead of 0.0.0.0:8120 so it only accepts connections from Apache.
Architecture 2: Trident in Front of Apache¶
Trident is the entry point. Cache misses are forwarded to Apache, which serves the application.
Trident Configuration¶
{
"license": {
"path": "/etc/trident/license.key"
},
"server": {
"listeners": [
{
"address": "0.0.0.0:8120"
}
],
"preserve_host": true
},
"backends": [
{
"name": "origin",
"host": "127.0.0.1",
"port": 8080
}
],
"security": {
"trusted_proxies": [
"127.0.0.1/32"
]
},
"cache": {
"poisoning": {
"known_hosts": [
"example.com",
"example.com:443"
]
}
},
"admin": {
"address": "127.0.0.1:6085",
"auth_token": "${TRIDENT_ADMIN_TOKEN}"
}
}
Apache Configuration¶
Configure Apache to serve the application on port 8080:
Listen 8080
<VirtualHost *:8080>
ServerName example.com
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php-fpm.sock|fcgi://localhost"
</FilesMatch>
</VirtualHost>
Forwarding trust and administration¶
The TLS example is a single-authority virtual host. Replace every literal
example.com:443 and server_name/ServerName with the externally served
authority and port. The edge sets authoritative Host, scheme and client IP,
removes forwarding aliases, and does not append attacker-provided chains.
Configure only the edge's actual immediate address in Trident's
security.trusted_proxies. Bind Trident and administration to an appropriate
private interface; loopback is appropriate when both processes share a host.
The Trident JSON examples require TRIDENT_ADMIN_TOKEN in the service
environment. Verify both the file and environment with the actual candidate's
--check command before starting or reloading the service.
Health checks¶
On the configured admin listener, GET /admin/health reports process health
and GET /admin/ready reports backend readiness. These health routes are
unauthenticated; keep administration private. The public proxy's /health
is an application/origin route, not an implicit Trident admin health check.
Cache invalidation¶
Send a supported authenticated admin request directly over the private admin
network, for example POST /admin/purge/url with JSON
{"url":"/products/example","host":"example.com:443","scheme":"https","mode":"hard"}
and Authorization: Bearer <operator-token>. Replace the authority and scheme
with the exact values used for the cached site. A generic /purge route is not the
current endpoint. Keep the admin listener and operator token restricted;
do not expose an unauthenticated purge proxy on the public virtual host.