> This page is for Applications Protection.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.humansecurity.com/llms.txt.

# Upgrading the Enforcer

## Upgrading from versions lower than 4.x

As of version 4.x the config builder was added. The config builder adds default values to properties that are not implicitly specified. This change requires the user to import the configuration in the `init_worker_by_lua_block` and `access_by_lua_block` blocks inside `nginx.conf`:

1. Modify `init_worker_by_lua_block`\
   `Lua`

   ```none
   init_worker_by_lua_block {
       local pxconfig = require("px.pxconfig")
       require ("px.utils.pxtimer").application(pxconfig)
   }
   ```
2. Modify `access_by_lua_block`\
   `Lua`

   ```none
   access_by_lua_block {
       local config = require('px.pxconfig')
       require("px.pxnginx").application(config)
   }
   ```
3. Modify `header_filter_by_lua_block`\
   `Lua`

   ```none
   header_filter_by_lua_block {
       require("px.pxnginx").finalize()
   }
   ```

## Upgrading from versions above 4.x

To upgrade to the latest Enforcer version, re-install the Enforcer according to your OS.