# Error with nginx as reverse proxy

**URL:** <https://discuss.hashicorp.com/t/error-with-nginx-as-reverse-proxy/34234>\
**Category:** Consul\
**Created:** [January 13, 2022, 5:49pm UTC](https://discuss.hashicorp.com/t/error-with-nginx-as-reverse-proxy/34234 "2022-01-13T17:49:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smutel](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/smutel/32/2687_2.png) [@smutel](https://discuss.hashicorp.com/u/smutel)\
**Post date:** [January 13, 2022, 5:49pm UTC](https://discuss.hashicorp.com/t/error-with-nginx-as-reverse-proxy/34234/1 "2022-01-13T17:49:45Z")

</div>

Hello,

I encountered this error messages in nginx as reverse proxy with consul:

```auto
2022/01/13 16:36:52 [error] 741#741: *425422 upstream timed out (110: Connection timed out) while reading response header from upstream, client: XX.XX.XX.XX, server: consul.service.xxxx, request: "GET /v1/kv/terraform/os-integ-manage-tenants.tfstate/.lock?consistent=&index=17011479 HTTP/1.1", upstream: "https://127.0.0.1:8501/v1/kv/terraform/os-integ-manage-tenants.tfstate/.lock?consistent=&index=17011479", host: "consul.service.xxxx"
2022/01/13 16:37:59 [error] 741#741: *425430 upstream timed out (110: Connection timed out) while reading response header from upstream, client: XX.XX.XX.XX, server: consul.service.xxxx, request: "GET /v1/kv/terraform/os-integ-manage-tenants.tfstate/.lock?consistent=&index=17011500 HTTP/1.1", upstream: "https://127.0.0.1:8501/v1/kv/terraform/os-integ-manage-tenants.tfstate/.lock?consistent=&index=17011500", host: "consul.service.xxxx"
2022/01/13 16:39:07 [error] 741#741: *425422 upstream timed out (110: Connection timed out) while reading response header from upstream, client: XX.XX.XX.XX, server: consul.service.xxxx, request: "GET /v1/kv/terraform/os-integ-manage-tenants.tfstate/.lock?consistent=&index=17011524 HTTP/1.1", upstream: "https://127.0.0.1:8501/v1/kv/terraform/os-integ-manage-tenants.tfstate/.lock?consistent=&index=17011524", host: "consul.service.xxxx"
2022/01/13 16:47:18 [warn] 741#741: *425901 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/8/15/0000000158 while reading upstream, client: XX.XX.XX.XX, server: consul.service.xxxx, request: "GET /v1/kv/terraform/os-integ-manage-tenants.tfstate HTTP/1.1", upstream: "https://127.0.0.1:8501/v1/kv/terraform/os-integ-manage-tenants.tfstate", host: "consul.service.xxxx"
2022/01/13 16:47:20 [warn] 741#741: *425901 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/9/15/0000000159 while reading upstream, client: XX.XX.XX.XX, server: consul.service.xxxx, request: "GET /v1/kv/terraform/os-integ-manage-tenants.tfstate HTTP/1.1", upstream: "https://127.0.0.1:8501/v1/kv/terraform/os-integ-manage-tenants.tfstate", host: "consul.service.xxxx"
2022/01/13 16:47:20 [warn] 741#741: *425901 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000160, client: XX.XX.XX.XX, server: consul.service.xxxx, request: "PUT /v1/txn HTTP/1.1", host: "consul.service.xxxx"
2022/01/13 16:47:20 [error] 741#741: *425901 SSL_write() failed (32: Broken pipe) while sending request to upstream, client: XX.XX.XX.XX, server: consul.service.xxxx, request: "PUT /v1/txn HTTP/1.1", upstream: "https://127.0.0.1:8501/v1/txn", host: "consul.service.xxxx"

```

In my nginx config, I have:

```auto
location / {
      add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

      proxy_connect_timeout 600;
      proxy_send_timeout 600;
      proxy_read_timeout 600;
      send_timeout 600;

      proxy_buffering off;
      proxy_pass https://127.0.0.1:8501;
    }

```

Any idea of the issue ?  
I am using consul 1.9.9.

Thanks.

---

<div class="post-metadata">

**Author:** ![smutel](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/smutel/32/2687_2.png) [@smutel](https://discuss.hashicorp.com/u/smutel)\
**Post date:** [January 14, 2022, 2:24pm UTC](https://discuss.hashicorp.com/t/error-with-nginx-as-reverse-proxy/34234/2 "2022-01-14T14:24:11Z")

</div>

Nothing related to Nginx in fact. My tfstate size was greater than the default limit (512ko).

I increased the limit in the consul config with:

```json
"limits": {
  "kv_max_value_size": 1024000,
  "txn_max_req_len": 1024000
},

```

---

<div class="post-metadata">

**Author:** ![eddie-rowe](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/eddie-rowe/32/24148_2.png) [@eddie-rowe](https://discuss.hashicorp.com/u/eddie-rowe)\
**Post date:** [January 18, 2022, 7:54pm UTC](https://discuss.hashicorp.com/t/error-with-nginx-as-reverse-proxy/34234/3 "2022-01-18T19:54:55Z")

</div>

Thank you for posting the solution, @smutel !
