<div dir="ltr">I see. I was introduced to apiman&#39;s codebase last week, so, it&#39;s just a rookie&#39;s opinion here. Glad I could help and thanks for the fast feedbacks. =)</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 26, 2016 at 10:49 AM Eric Wittmann &lt;<a href="mailto:eric.wittmann@redhat.com">eric.wittmann@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">OK thanks for the info - very helpful.<br>
<br>
Regarding OK vs Apache - there is a design reason why OK is being used<br>
vs. Apache that is perhaps not that interesting to get into.  It has to<br>
do with the way in which we stream the body of the request (and response).<br>
<br>
I agree with the assessment of smart vs. dumb proxies - the apiman<br>
gateway should definitely not be adding anything to the conversation<br>
that wasn&#39;t configured via one of the policies.  I definitely consider<br>
this a bug, but I think it may require a fairly substantial rewrite of<br>
the http connector to fix it. :(  I&#39;m not against doing it, but I was<br>
hoping for a quick fix.<br>
<br>
-Eric<br>
<br>
<br>
On 7/26/2016 9:30 AM, Jairo Junior wrote:<br>
&gt; It results in a &quot;415 Unsupported Media Type&quot; at the endpoint, since it<br>
&gt; wasn&#39;t designed to consume application/x-www-form-urlencoded.<br>
&gt;<br>
&gt; I have experience with some ESB&#39;s, and, in most cases, when you have a<br>
&gt; proxy that is &quot;too smart&quot; it may break your endpoint behavior. And when<br>
&gt; we are talking about REST APIs, where we are using HTTP as both a<br>
&gt; transport and application protocol, any apiman interference may break<br>
&gt; behavior. It&#39;s OK for new APIs, but it&#39;s very bad for legacy.<br>
&gt;<br>
&gt; IMHO, if the gateway is deliberately including headers, there won&#39;t be<br>
&gt; any guarantees that the endpoint will be prepared for this. There is a<br>
&gt; general discussion in Microservices community regarding Smart Pipe X<br>
&gt; Dumb Pipe that is very relevant to what we are discussing here.<br>
&gt;<br>
&gt; Also, I thinkg okhttp is the best alternative when you&#39;re developing a<br>
&gt; client, but is it good to proxy requests? Have you considered Apache<br>
&gt; HTTP Client + PoolingHttpClientConnectionManager. It has some nice<br>
&gt; features like &quot;per route&quot; connection pooling that will probably be<br>
&gt; killing for a Gateway.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Jul 26, 2016 at 9:53 AM Eric Wittmann &lt;<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a><br>
&gt; &lt;mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     Question:  what is the consequence of this problem?<br>
&gt;<br>
&gt;     It turns out that fixing this issue may require fairly extensive changes<br>
&gt;     to how apiman proxies the request to the back end API.  The<br>
&gt;     http client[1] we are using for this is adding the content length and<br>
&gt;     content type automatically for DELETE (as well as PUT and POST) if they<br>
&gt;     are missing.  It&#39;s doing this because it claims the HTTP spec is<br>
&gt;     ambiguous on whether DELETE can have a body.<br>
&gt;<br>
&gt;     So how high a priority is this?  Is it causing a specific problem for<br>
&gt;     you, or is it simply something you noticed?<br>
&gt;<br>
&gt;     -Eric<br>
&gt;<br>
&gt;     [1] <a href="http://square.github.io/okhttp/" rel="noreferrer" target="_blank">http://square.github.io/okhttp/</a><br>
&gt;<br>
&gt;<br>
&gt;     On 7/25/2016 10:06 AM, Jairo Junior wrote:<br>
&gt;     &gt; Thanks again.<br>
&gt;     &gt;<br>
&gt;     &gt; On Mon, Jul 25, 2016 at 10:49 AM Eric Wittmann<br>
&gt;     &lt;<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a> &lt;mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a>&gt;<br>
&gt;     &gt; &lt;mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a><br>
&gt;     &lt;mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a>&gt;&gt;&gt; wrote:<br>
&gt;     &gt;<br>
&gt;     &gt;     JIRA issue created.  In case you want to track it:<br>
&gt;     &gt;<br>
&gt;     &gt;        <a href="https://issues.jboss.org/browse/APIMAN-1210" rel="noreferrer" target="_blank">https://issues.jboss.org/browse/APIMAN-1210</a><br>
&gt;     &gt;<br>
&gt;     &gt;     -Eric<br>
&gt;     &gt;<br>
&gt;     &gt;     On 7/25/2016 9:14 AM, Jairo Junior wrote:<br>
&gt;     &gt;     &gt; A client-side javascript app is performing the following<br>
&gt;     request:<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; /DELETE /apiman-gateway/org/service/1.1/resource/7 HTTP/1.1<br>
&gt;     &gt;     &gt; Host: <a href="http://172.17.0.1:8080" rel="noreferrer" target="_blank">172.17.0.1:8080</a> &lt;<a href="http://172.17.0.1:8080" rel="noreferrer" target="_blank">http://172.17.0.1:8080</a>&gt;<br>
&gt;     &lt;<a href="http://172.17.0.1:8080" rel="noreferrer" target="_blank">http://172.17.0.1:8080</a>&gt;<br>
&gt;     &gt;     &lt;<a href="http://172.17.0.1:8080" rel="noreferrer" target="_blank">http://172.17.0.1:8080</a>&gt;<br>
&gt;     &gt;     &gt; User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0)<br>
&gt;     &gt;     &gt; Gecko/20100101 Firefox/47.0<br>
&gt;     &gt;     &gt; Accept: application/json, text/plain, */*<br>
&gt;     &gt;     &gt; Accept-Language: en-US,en;q=0.5<br>
&gt;     &gt;     &gt; Accept-Encoding: gzip, deflate<br>
&gt;     &gt;     &gt; Authorization: Bearer $ACCESS_TOKEN<br>
&gt;     &gt;     &gt; Referer: <a href="http://172.17.0.1:3000/" rel="noreferrer" target="_blank">http://172.17.0.1:3000/</a><br>
&gt;     &gt;     &gt; Origin: <a href="http://172.17.0.1:3000" rel="noreferrer" target="_blank">http://172.17.0.1:3000</a><br>
&gt;     &gt;     &gt; Connection: keep-alive<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; /<br>
&gt;     &gt;     &gt; But the gateway is performing the following request to the<br>
&gt;     endpoint:<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; /DELETE /service/rest/resource/7 HTTP/1.1<br>
&gt;     &gt;     &gt; User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT<br>
&gt;     5.1; SV1)<br>
&gt;     &gt;     &gt; Origin: <a href="http://172.17.0.1:3000" rel="noreferrer" target="_blank">http://172.17.0.1:3000</a><br>
&gt;     &gt;     &gt; Accept-Language: en-US,en;q=0.5<br>
&gt;     &gt;     &gt; Accept-Encoding: gzip, deflate<br>
&gt;     &gt;     &gt; Connection: keep-alive<br>
&gt;     &gt;     &gt; Authorization: Bearer $ACCESS_TOKEN<br>
&gt;     &gt;     &gt; Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,<br>
&gt;     &gt;     &gt; application/vnd.ms-excel, application/msword,<br>
&gt;     &gt;     &gt; application/vnd.ms-powerpoint, */*<br>
&gt;     &gt;     &gt; Referer: <a href="http://172.17.0.1:3000/" rel="noreferrer" target="_blank">http://172.17.0.1:3000/</a><br>
&gt;     &gt;     &gt; Host: <a href="http://172.17.0.1:8280" rel="noreferrer" target="_blank">172.17.0.1:8280</a> &lt;<a href="http://172.17.0.1:8280" rel="noreferrer" target="_blank">http://172.17.0.1:8280</a>&gt;<br>
&gt;     &lt;<a href="http://172.17.0.1:8280" rel="noreferrer" target="_blank">http://172.17.0.1:8280</a>&gt;<br>
&gt;     &gt;     &lt;<a href="http://172.17.0.1:8280" rel="noreferrer" target="_blank">http://172.17.0.1:8280</a>&gt;<br>
&gt;     &gt;     &gt; Content-Type: application/x-www-form-//urlencoded<br>
&gt;     &gt;     &gt; Content-Length: 0<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; /<br>
&gt;     &gt;     &gt; Resulting in a 415 Unsupported Media Type at the endpoint.<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; GET, POST and PUT requests are OK.<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; Only using CORS Policy for this endpoint:<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; /Access-Control-Allow-Origin: *<br>
&gt;     &gt;     &gt; Access-Control-Allow-Credentials: true<br>
&gt;     &gt;     &gt; Access-Control-Allow-Headers: accept, authrotization,<br>
&gt;     content-type<br>
&gt;     &gt;     &gt; Access-Control-Allow-Methods: GET, POST, PUT, DELETE<br>
&gt;     &gt;     &gt; Access-Control-Max-Age: 3600/<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; _______________________________________________<br>
&gt;     &gt;     &gt; Apiman-user mailing list<br>
&gt;     &gt;     &gt; <a href="mailto:Apiman-user@lists.jboss.org" target="_blank">Apiman-user@lists.jboss.org</a><br>
&gt;     &lt;mailto:<a href="mailto:Apiman-user@lists.jboss.org" target="_blank">Apiman-user@lists.jboss.org</a>&gt;<br>
&gt;     &lt;mailto:<a href="mailto:Apiman-user@lists.jboss.org" target="_blank">Apiman-user@lists.jboss.org</a><br>
&gt;     &lt;mailto:<a href="mailto:Apiman-user@lists.jboss.org" target="_blank">Apiman-user@lists.jboss.org</a>&gt;&gt;<br>
&gt;     &gt;     &gt; <a href="https://lists.jboss.org/mailman/listinfo/apiman-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/apiman-user</a><br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;<br>
&gt;<br>
</blockquote></div>