> ## Documentation Index
> Fetch the complete documentation index at: https://docs.porter.run/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced networking

> Customize NGINX ingress annotations for your Porter web services including read/write timeouts, request body size limits, and WebSocket support

## Customizing Network Settings for an Application[](#customizing-network-settings-for-an-application "Direct link to heading")

On Porter, you have the flexibility to customize the NGINX configuration for each of your Web service by adding an "Ingress Annotation" when deploying a web service. This can be found in the "Networking" tab of the web service.

<img src="https://mintcdn.com/porter/NkmSD5B3JYkw7n0Y/images/deploy/v2/nginx-annotations.webp?fit=max&auto=format&n=NkmSD5B3JYkw7n0Y&q=85&s=7c38f51b237213ee6cc34de688b2818e" alt="Ingress Annotations" width="1780" height="1418" data-path="images/deploy/v2/nginx-annotations.webp" />

To add an annotation, add the key-value pairs for an annotation you want to add. For a full list of NGINX annotations you can add to the service, please consult [this documentation](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/).
Below are the most common custom networking options we see among our users.

### Setting Custom Read/Write Timeouts[](#setting-custom-readwrite-timeouts "Direct link to heading")

Read/write timeouts are very application-specific, and are subject to change on the Porter templates. For example, if you have a websocket application that does not handle dropped connections gracefully, you may be inclined to set your read/write timeout to be much higher than what is standard (\~30 seconds). For those coming from Heroku, the Heroku router enforces a write timeout of 30 seconds, and will keep a connection alive if a single byte is sent within a 55 second window.

On Porter, you can configure your own read/write timeouts by adding annotations:

```
nginx.ingress.kubernetes.io/proxy-connect-timeout: "60"
nginx.ingress.kubernetes.io/proxy-read-timeout: "60"
nginx.ingress.kubernetes.io/proxy-send-timeout: "60"

```

Note: All timeout values are unitless and in seconds - for instance, `nginx.ingress.kubernetes.io/proxy-read-timeout: "120"` sets a valid 120 seconds proxy read timeout.

For an explanation of these values:

| Annotation                                        | Description                                                            |
| ------------------------------------------------- | ---------------------------------------------------------------------- |
| nginx.ingress.kubernetes.io/proxy-connect-timeout | The timeout for NGINX to establish a connection with your application. |
| nginx.ingress.kubernetes.io/proxy-send-timeout    | The timeout for NGINX to transmit a request to your application.       |
| nginx.ingress.kubernetes.io/proxy-read-timeout    | The timeout for NGINX to read a response from your application.        |

It is thus recommended to set these values with the ordering `proxy-connect-timeout <= proxy-send-timeout <= proxy-read-timeout`.

### Client Max Body Size[](#client-max-body-size "Direct link to heading")

If you are getting undesired `413 Request Entity Too Large` errors, you can increase the maximum size of the client request by setting the field [client\_max\_body\_size](http://nginx.org/en/docs/http/ngx%5Fhttp%5Fcore%5Fmodule.html#client%5Fmax%5Fbody%5Fsize). You can do this by adding the following annotation:

```
nginx.ingress.kubernetes.io/proxy-body-size: 8m

```

This will set the maximum client request body size to 8 megabytes.

To learn more about NGINX units, see [this document](http://nginx.org/en/docs/syntax.html).

### Header Size[](#header-size "Direct link to heading")

If you are occasionally getting 500-level errors on certain endpoints, your application may be sending response headers which are too large for NGINX to process. You can try increasing the maximum value of the response header size by setting something like the following (default is `1k`):

```
nginx.ingress.kubernetes.io/proxy-buffer-size: 10k
```
