400 Bad Request when call API point to HTTPS

670 views
Skip to first unread message

dzung1...@gmail.com

unread,
Mar 29, 2017, 4:00:42 AM3/29/17
to Kong
Hi,


My API:

{
  "methods": [
    "GET"
  ],
  "uris": [
    "/json/v1/dz/products"
  ],
  "id": "b68e6892-6337-4211-92a5-6150b73c6071",
  "hosts": [
  ],
  "preserve_host": false,
  "created_at": 1490754001000,
  "upstream_connect_timeout": 60000,
  "strip_uri": true,
  "name": "get_products",
  "https_only": true,
  "http_if_terminated": true,
  "retries": 5,
  "upstream_send_timeout": 60000,
  "upstream_read_timeout": 60000
}

----------------------------------------------------


ERROR:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
    <head>
        <title>400 Bad Request</title>
    </head>
    <body>
        <h1>Bad Request</h1>
        <p>Your browser sent a request that this server could not understand.
            <br />
        </p>
        <hr>
        <address>Apache/2.4.12 (Ubuntu) Server at beta.zingzing.com Port 443</address>
    </body>
</html>


I have enabled SSL for 2 domain and use HTTPS on them

Pls have a look at that.

Thank you so much.





Thibault Charbonnier

unread,
Mar 29, 2017, 1:49:38 PM3/29/17
to kong...@googlegroups.com
Hi,

Could this be related to the trailing slash issue of Kong 0.10.0? See:

    https://github.com/Mashape/kong/issues/2211

If you make a direct request to:

    $ curl https://beta.zingzing.com/wp-json/wc/v1/products/
   
    (note the trailing slash)

Does Apache reply with HTTP 400 as well? If so, then this is Kong making this request with a trailing slash in the URI. If that is the case, let us know here or on the GitHub issue, thanks!

Best,
Thibault
--
You received this message because you are subscribed to the Google Groups "Kong" group.
To unsubscribe from this group and stop receiving emails from it, send an email to konglayer+...@googlegroups.com.
To post to this group, send email to kong...@googlegroups.com.
Visit this group at https://groups.google.com/group/konglayer.
To view this discussion on the web visit https://groups.google.com/d/msgid/konglayer/df15459f-c0d6-4d9f-9579-d3d868e90f2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dzung1...@gmail.com

unread,
Mar 29, 2017, 11:17:57 PM3/29/17
to Kong, dzung1...@gmail.com
Hi Thibault,

Thank you for your answer.

I am using Kong 0.10.0.

With HTTP, that api work ok, but, if i update upstream_url from HTTP to HTTPS, and call api, it return 400 Bad Request.

I just fixed it

in /usr/local/share/lua/5.1/kong/templates

add new line: proxy_ssl_name $upstream_host;

https://github.com/Mashape/kong/issues/2129












Reply all
Reply to author
Forward
0 new messages