Customizing Network Settings for an Application
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:
Setting Custom Read/Write Timeouts
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-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. |
proxy-connect-timeout <= proxy-send-timeout <= proxy-read-timeout
.
Client Max Body Size
If you are getting undesired413 Request Entity Too Large
errors, you can increase the maximum size of the client request by setting the field client_max_body_size. You can do this by adding the following annotation:
Header Size
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 is1k
):