POST executed as GET

I have a very simple example API that I am testing out with a Kong Cloud trial account. When I attempt to execute a POST request through the proxy, my API is receiving a GET request on the backend. I have verified that this does not occur when sending the POST directly to my backend API.

Here’s my service / route configuration:

{
    "next": null,
    "data": [
        {
            "host": "*****",
            "created_at": 1574355278,
            "connect_timeout": 60000,
            "id": "*****",
            "protocol": "http",
            "name": "example-api-1",
            "read_timeout": 60000,
            "port": 80,
            "path": null,
            "updated_at": 1574355278,
            "tags": null,
            "client_certificate": null,
            "retries": 5,
            "write_timeout": 60000
        }
    ]
}

{
    "next": null,
    "data": [
        {
            "id": "*****",
            "tags": null,
            "updated_at": 1574360319,
            "destinations": null,
            "headers": null,
            "protocols": [
                "http"
            ],
            "created_at": 1574355278,
            "snis": null,
            "service": {
                "id": "*****"
            },
            "name": null,
            "strip_path": false,
            "preserve_host": false,
            "regex_priority": 0,
            "paths": [
                "/api/Employee"
            ],
            "sources": null,
            "methods": [
                "GET",
                "POST"
            ],
            "https_redirect_status_code": 426,
            "hosts": null
        }
    ]
}

Does anyone know what may be causing the issue?

Do you have a plugin enabled on the request path that is transforming your request?

Originally I had openid, api key, correlationid, and acl plugins enabled for the route. I disabled all of my plugins while debugging and was still not able to POST to the backend service.

How are you deducing the fact that it is coming to your service as a GET request and not a POST request?

My service is logging the request method as a GET and returning the results. If I point the same exact POST directly at the service, the service logs a POST and processes it appropriately.

Any other ideas on what could cause this problem?

To rule out it is Kong that’s doing that, I’d recommend to create a route and a service that points to httpbin.org and then verify if that works using the /post endpoint:
http://www.httpbin.org/#/HTTP_Methods/post_post

The post worked with httpbin. I looked more into the service and it turned out the reverse proxy was redirecting my requests because they were not over https. I was not aware that was a feature of the proxy.

Thanks for your help!


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ