# HAProxy Cache-Control Lua Library

Lua library for setting Cache-Control related response headers in HAProxy.

# Background

Generally, we want to set:

```
  http-response add-header Cache-Control no-cache
  http-response add-header Expires 0
  http-response add-header Pragma no-cache
```

However, a few services/endpoints that are proxied through ows-grass actually explicitly set some or all of these. In that case, we would not want HAProxy to override them.

This library checks the would-be response header for these values. If they are not present, the strict headers/values will be put into the response headers.

## Dependencies

* HAProxy must be compiled with Lua support.

## Installation

Copy the *cachechontrol.lua* file to the server where you run HAProxy.

## Usage

Load the *cachecontrol.lua* file via the `lua-load` directive in the `global` section of your HAProxy configuration:

```
global
    log stdout local0
    lua-load /path/to/cachecontrol.lua
```


Invoke the `http-response lua.cachecontrol` action.

```
http-response lua.cachecontrol
```
