File: README.md

package info (click to toggle)
trafficserver 9.2.5%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 53,008 kB
  • sloc: cpp: 345,484; ansic: 31,134; python: 24,200; sh: 7,271; makefile: 3,045; perl: 2,261; java: 277; pascal: 119; sql: 94; xml: 2
file content (38 lines) | stat: -rw-r--r-- 1,541 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
This is a simple plugin to serve static content from a local filesystem. It shares some of the same functionality as the `healthchecks` plugin, but can be used in the remap context(thereby making it reloadable). It does not use fsnotify for watching the source files.

If the file specified by the `--file-path` parameter is not found, the plugin will return the status code specified
by the `--failure-code` parameter, defaulting to a 404. If the file is found, it will return the contents of the file
setting the `Content-Type` header to the value specified on the `--mime-type` parameter.

Metrics
--------

The plugin publishes the following metrics:

statichit.response_bytes:
  The total number of bytes emitted
statichit.response_count:
  The number of HTTP responses generated by the plugin

Examples:
-----------

remap.config:
```
map /internal/healthcheck \
   http://127.0.0.1 \
   @plugin=statichit.so @pparam=--file-path=/var/run/trafficserver/healthcheck.txt \
   @pparam=--mime-type=text/plain \
   @pparam=--success-code=200 \
   @pparam=--failure-code=403 \
   @pparam=--max-age=0

map http://content.example.com/content.txt \
   http://127.0.0.1 \
   @plugin=statichit.so @pparam=--file-path=/opt/ats/etc/trafficserver/static/content_source.txt \
   @pparam=--failure-code=404 \
   @pparam=--max-age=604800

```

NOTE: The remap origin is never contacted because this plugin intercepts the request and acts as the origin server. For that reason, the origin specification must be syntactically valid and resolvable in DNS.