# ModSecurity for Kong

**URL:** <https://discuss.konghq.com/t/modsecurity-for-kong/4621>\
**Category:** General\
**Created:** [October 11, 2019, 3:06pm UTC](https://discuss.konghq.com/t/modsecurity-for-kong/4621 "2019-10-11T15:06:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![moenam](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@moenam](https://discuss.konghq.com/u/moenam)\
**Post date:** [October 11, 2019, 3:06pm UTC](https://discuss.konghq.com/t/modsecurity-for-kong/4621/1 "2019-10-11T15:06:29Z")

</div>

Hi,

We have kong version 0.14.1 based on the below images:

> **[Kong/docker-kong](https://github.com/Kong/docker-kong/tree/master/ubuntu)**
>
> :monkey: Docker distribution for Kong. Contribute to Kong/docker-kong development by creating an account on GitHub.

I’m wondering how can I implement **Modsecurity** WAF on top of Kong’s **OpenResty for Nginx**.

I have installed ModSecurity, and complied the same OpenResty version that exist on the kong image, and then I configured Nginx associated with Openresty for ModSecurity. But I’m missing the part of configuring Kong’s Nginx so that all the API requests go through it.

For example, I have a rule to prevent the word " **testwaf**" when running a curl command as below:

**curl localhost?testparam=testwaf** --\> 403 forbidden

How can I do the sam for the API requests:

**curl localhost:8001?testparam=testwaf**  
**curl localhost:8000?testparam=testwaf**

The Nginx file I configured is:  
**/usr/local/openresty/nginx/conf/nginx-modsec.conf**

while the file Nginx files under Kong directory are:  
**/usr/local/kong/nginx.conf  
/usr/local/kong/nginx-kong.conf**

I used: **export KONG\_NGINX\_HTTP\_INCLUDE="/usr/local/openresty/nginx/conf/nginx-modsec.conf"** to include it to kong, but didn’t work for api links.
