Parameters in the request body not included in the request made to the backend

Imported Google Group message. Original thread at: https://groups.google.com/forum/#!topic/tyk-community-support/-aEjmtdlgmk Import Date: 2016-01-19 21:11:09 +0000.
Sender:Miii Eeee.
Date:Tuesday, 28 April 2015 16:32:53 UTC+1.

Hi,

I have configured a POST endpoint using the endpoint designer and I have observed that when i make API request I am redirected to the backend configured, but the parameters in the request body that I include in my API request are not included in the request that is made to the backend.

Am I doing something wrong or this is the expected behaviour?

Thanks,

M

Imported Google Group message.
Sender:Martin Buhr.
Date:Tuesday, 28 April 2015 16:43:24 UTC+1.

Hi,

You shouldn’t be redirected - the request should be proxied transparently, unless that’s what you meant?

It isn’t expected behaviour, Tyk doesn’t touch the request on the way through unless you’ve set up a transform template, in which case it will replace the body based on whatever transformation template you have configured.

Are you using caching?

thanks,
Martin

  • show quoted text -

Imported Google Group message.
Sender:Miii Eeee.
Date:Tuesday, 5 May 2015 10:35:47 UTC+1.

Hi,

I installed tyk 1.6 and disabled caching from my API and now this is what I see in the log when I make a POST request:

  • Hostname was NOT found in DNS cache
  • Trying 127.0.0.1…
  • Connected to localhost (127.0.0.1) port 8080 (#0)

POST /f1704c1ec4004cc457200a35afb75919/o/token/?authKey=xxxxxxxxx HTTP/1.1
User-Agent: curl/7.35.0
Host: localhost:8080
Accept: /
Content-Length: 287
Content-Type: application/x-www-form-urlencoded

  • upload completely sent off: 287 out of 287 bytes
    < HTTP/1.1 500 Internal Server Error
    < Date: Tue, 05 May 2015 09:29:43 GMT
    < Content-Length: 0
    < Content-Type: text/plain; charset=utf-8
    <
  • Connection #0 to host localhost left intact

The request I made was:

curl -v -k -X POST -d “param1=xxx&param2=yyyy&param3=zzzzz” http://localhost:8080/f1704c1ec4004cc457200a35afb75919/o/token/?authKey=xxxxxxxxx

In the tyk standard output I see the following error

time=“2015-05-05T09:29:43Z” level=info msg=“http: proxy error: http: ContentLength=287 with Body length 0”

Any idea what might be wrong in my setup?

Thanks,

M

  • show quoted text -

Imported Google Group message.
Sender:Martin Buhr.
Date:Tuesday, 5 May 2015 12:18:13 UTC+1.

Hi,

It looks like a bug, because you are using the auth key as a URL parameter and sending the data form-encoded, when Tyk reads out the auth key it’s likely that it is destroying the body so it cant be procesed again, so when it examines the request the content-length and the body length don;t match up anymore, this breaks the processing flow - this could be golang specific, so will need deeper investigation.

You can get round this by setting the content type:

curl -v -k -H “Content-Type:text/plain” --data “param1=xxx&param2=yyyy&param3=zzzzz” http://host.org:8080/API-ID/post?authKey=xxxxxx

If you raise a github issue we’ll check it out.

Thanks,
Martin

  • show quoted text -