JSON Post Requests getting mangled

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"}}

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?

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 works for me.

Thanks!