Behavior of "strip_request_path" property

56 views
Skip to first unread message

​Suraj ​Kumar

unread,
Jul 27, 2016, 2:48:20 AM7/27/16
to Kong
I am using Kong v0.8 with cassandra 2.2. According to documentation if strip_request_path is set to true it will not include request path in upstream URL. But I am seeing strange behavior  of this property.
I have registered a API on Kong with below configuration

{
  "data": [
    {
      "upstream_url": "http://api1.azuga.com/",
      "strip_request_path": true,
      "request_path": "/services",
      "id": "586b4dc2-78d2-4dd2-beee-d2a4816fc718",
      "created_at": 1465976452000,
      "preserve_host": false,
      "name": "services",
      "request_host": "api1.azuga.com"
    }
  ],
  "total": 1
}

actual end point is : http://api1.azuga.com/services/timezone.json

request URL through Kong: http://<kong>/services/timezone.json
My 1st question is:
how is Kong  successfully mapping this URL, since strip_request_path is true and according to documentation Kong should forward this request to  http://api1.azuga.com/timezone.json which is not valid. I am not even using request host header.

How does strip_request_path property work? am I getting it wrong?

thanks for any advice.




Thijs Schreijer

unread,
Jul 27, 2016, 3:56:18 AM7/27/16
to Kong
You provide both the request host and the request path. Host takes precedence, so the match is made on host.

Strip request path only applies if the match is on path.

Recreate your api without the request host value, then it will strip the path.

​Suraj ​Kumar

unread,
Jul 27, 2016, 4:34:03 AM7/27/16
to Thijs Schreijer, Kong
Ok I will try that. But I need some clarification :
1. I am not passing host parameter in Request Header. Then how Kong will know where to forward this request. how it will behave if I have registered multiple APIs?

2.I read it some where in google group the strip_request_path property will determine weather include request_path in upstream URL or not regardless of the way how routing is done. is it not correct?
thanks.

Thanks
 Suraj


--
You received this message because you are subscribed to a topic in the Google Groups "Kong" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/konglayer/gPErH4MpS2o/unsubscribe.
To unsubscribe from this group and all its topics, 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/12bbc744-b9ab-45e0-9e86-a67f07d0590f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages