# JSON Post Requests getting mangled

**URL:** <https://community.convox.com/t/json-post-requests-getting-mangled/67>\
**Category:** Rack (Version 2)\
**Created:** [February 8, 2019, 1:09am UTC](https://community.convox.com/t/json-post-requests-getting-mangled/67 "2019-02-08T01:09:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![g11](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.convox.com/g11/32/56_2.png) [@g11](https://community.convox.com/u/g11)\
**Post date:** [February 8, 2019, 1:09am UTC](https://community.convox.com/t/json-post-requests-getting-mangled/67/1 "2019-02-08T01:09:14Z")

</div>

I’m running into a problem where my http(s) requests are getting mangled before they reach my application. Any help would be greatly appreciated.

```
~ ❯❯❯ convox version 17:06:35
client: 20190205165821
server: 20190205165821 (rack.convox)

~ ❯❯❯ convox rack 17:06:41Name convox
Provider local
Status running
Version 20190205165821

~ ❯❯❯ docker version 17:07:52
Client: Docker Engine - Community
 Version: 18.09.1
 API version: 1.39
 Go version: go1.10.6
 Git commit: 4c52b90
 Built: Wed Jan 9 19:33:12 2019
 OS/Arch: darwin/amd64
 Experimental: false

Server: Docker Engine - Community
 Engine:
  Version: 18.09.1
  API version: 1.39 (minimum version 1.12)
  Go version: go1.10.6
  Git commit: 4c52b90
  Built: Wed Jan 9 19:41:49 2019
  OS/Arch: linux/amd64
  Experimental: true    

```

HTTPS POST from outside the container

```
POST /pmapi/v1/card-products.json HTTP/1.1
Host: web.platform.convox
User-Agent: curl/7.54.0
Transfer-Encoding: chunked
Accept: application/json
Content-Type: application/json
X-Api-Key: BUxtJEfL12Om-bXf3C4oXZEz0DqxYc8-SimjVxsKcfWjhgAQrrDWmOc4_TvrvP1AbWRzD3SE3etZ0saRQLYMbA
X-Forwarded-For: 192.168.65.3:44442
X-Forwarded-Port: 443
X-Forwarded-Proto: https
Accept-Encoding: gzip
Connection: close

25
{"card_product": {"issuer": "xxxxx"}}
0

```

HTTP POST from outside the container

```
GET /pmapi/v1/card-products HTTP/1.1
Host: web.platform.convox
User-Agent: insomnia/6.3.2
Accept: application/json
Content-Type: application/json
X-Api-Key: BUxtJEfL12Om-bXf3C4oXZEz0DqxYc8-SimjVxsKcfWjhgAQrrDWmOc4_TvrvP1AbWRzD3SE3etZ0saRQLYMbA
X-Forwarded-For: 192.168.65.3:52262
X-Forwarded-Port: 443
X-Forwarded-Proto: https
Accept-Encoding: gzip
Connection: close

```

HTTPS POST from inside the container

```
POST /pmapi/v1/card-products.json HTTP/1.1
Host: localhost:3000
User-Agent: curl/7.52.1
accept: application/json
content-type: application/json
x-api-key: BUxtJEfL12Om-bXf3C4oXZEz0DqxYc8-SimjVxsKcfWjhgAQrrDWmOc4_TvrvP1AbWRzD3SE3etZ0saRQLYMbA
Content-Length: 37

{"card_product": {"issuer": "xxxxx"}}
```

---

<div class="post-metadata">

**Author:** ![ddollar](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.convox.com/ddollar/32/3_2.png) [@ddollar](https://community.convox.com/u/ddollar)\
**Post date:** [February 8, 2019, 4:17pm UTC](https://community.convox.com/t/json-post-requests-getting-mangled/67/2 "2019-02-08T16:17:46Z")

</div>

Your request to the router is using `Transfer-Encoding: chunked` but the request between the router and your container is not. Do you need this transfer-encoding preserved?

---

<div class="post-metadata">

**Author:** ![g11](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.convox.com/g11/32/56_2.png) [@g11](https://community.convox.com/u/g11)\
**Post date:** [February 15, 2019, 12:02am UTC](https://community.convox.com/t/json-post-requests-getting-mangled/67/3 "2019-02-15T00:02:17Z")

</div>

Aha, you’re right… Ruby web servers seem to have a very hard time dealing with it.

In case anyone stumbles onto this, [this gist](https://gist.github.com/thom-nic/8b586749d3b88bef8c59) works for me.

Thanks!
