In here, I assume that iocane has already been [configured](@/configuration/index.md) and [deployed](@/deploying/iocaine.md). Furthermore, lets assume that we have a site running at `[::1]:8080`, and we want to serve that with `nginx`. Normally, that would look something like this:
To serve something different for AI user agents, the idea is to create a mapping between user-agent and badness, such that AI agents will evaluate to a truthy value, while unmatched against will default to a false-y one. We can do this with a `map` outside of the `server` block:
You can put this into a file common between all servers, like `/etc/nginx/conf.d/iocaine.conf`, because on many distributions, any `*.conf` file under `/etc/nginx/conf.d` will get automatically included. This way, you can share it between servers, without having to include it from multiple files manually.
Within the `server` block, we'll rewrite the URL if find a match on `$badagent`, and the proxy *that* location through to `iocaine`. The reason we need the `rewrite` is that `nginx` does not support `proxy_pass` within an `if` block. In the end, our `server` block will look like this: