<div dir="ltr">I attached an image. Also I added different kinds of headers, just to pass in case of &quot;Camel Case&quot; validation<br>Unfortunately the CORS validation still occurs when I use the plugin...<br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-02 15:00 GMT-03:00 Marc Savy <span dir="ltr">&lt;<a href="mailto:marc.savy@redhat.com" target="_blank">marc.savy@redhat.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is from memory, but no, I don&#39;t think so: the API key is needed<br>
before the correct policy chain (including CORS policy) can be<br>
resolved.<br>
<br>
The CORS protocol, when using a custom header, requires a preflight<br>
request, however the preflight does not allow any custom headers to be<br>
set, so we can&#39;t currently resolve the correct policy chain.<br>
<br>
We could think about specifically making X-API-Key available for<br>
preflight as I think that should always be okay, but I&#39;ll have to<br>
investigate whether there are any downsides.<br>
<br>
Of course, we could continue saying to use a query param in that scenario!<br>
<div class="HOEnZb"><div class="h5"><br>
On 2 October 2017 at 18:37, Eric Wittmann &lt;<a href="mailto:eric.wittmann@redhat.com">eric.wittmann@redhat.com</a>&gt; wrote:<br>
&gt; Just to be clear - if X-API-Key is added as an allowed CORS header in the<br>
&gt; CORS plugin configuration, does that solve the issue?<br>
&gt;<br>
&gt; -Eric<br>
&gt;<br>
&gt;<br>
&gt; On Mon, Oct 2, 2017 at 1:17 PM, Celso Agra &lt;<a href="mailto:celso.agra@gmail.com">celso.agra@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; So, there is no prob to pass as query param!<br>
&gt;&gt;<br>
&gt;&gt; Thanks Marc<br>
&gt;&gt;<br>
&gt;&gt; Best Regards,<br>
&gt;&gt;<br>
&gt;&gt; Celso Agra<br>
&gt;&gt;<br>
&gt;&gt; 2017-10-02 13:49 GMT-03:00 Marc Savy &lt;<a href="mailto:marc.savy@redhat.com">marc.savy@redhat.com</a>&gt;:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hi Celso,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The query string is encrypted with SSL/TLS.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Regards,<br>
&gt;&gt;&gt; Marc<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On 2 October 2017 at 17:40, Celso Agra &lt;<a href="mailto:celso.agra@gmail.com">celso.agra@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Yeah! It is! My concern is because I&#39;m passing the apiKey as a query<br>
&gt;&gt;&gt;&gt; param.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I don&#39;t know if requests works like this in ssl requests, but I believe<br>
&gt;&gt;&gt;&gt; that query params can be viewed if you have a sniffer, unlike header params.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; So, I&#39;m probably have to allow X-API-Key header in Apiman requests.<br>
&gt;&gt;&gt;&gt; Would be possible to add this feature in a plugin or maybe in the Apiman?<br>
&gt;&gt;&gt;&gt; I&#39;ll take a look in some classes to know how to do that.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I&#39;d like to know if it is a feature that will contribute with the<br>
&gt;&gt;&gt;&gt; project.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Thanks for your answer Marc.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Best Regards,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Celso Agra<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; 2017-10-02 9:18 GMT-03:00 Marc Savy &lt;<a href="mailto:marc.savy@redhat.com">marc.savy@redhat.com</a>&gt;:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; If I understand your questions correctly: by default CORS does not<br>
&gt;&gt;&gt;&gt;&gt; allow any custom headers to be sent in the request. This means that Apiman<br>
&gt;&gt;&gt;&gt;&gt; does not receive the X-API-Key header and necessarily can&#39;t figure out how<br>
&gt;&gt;&gt;&gt;&gt; to route the request. The same CORS restriction does not exist with query<br>
&gt;&gt;&gt;&gt;&gt; parameters so if you provide it with the query param you&#39;ll be okay.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Perhaps a (partial) solution to some of these kinds of CORS issues is<br>
&gt;&gt;&gt;&gt;&gt; for Apiman to always indicate that the X-API-Key header is allowed.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Regards,<br>
&gt;&gt;&gt;&gt;&gt; Marc<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; On 27 September 2017 at 05:35, Celso Agra &lt;<a href="mailto:celso.agra@gmail.com">celso.agra@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Hi all,<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; I got some errors with CORS plugin when I try to use my API with a<br>
&gt;&gt;&gt;&gt;&gt;&gt; contract.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; So, I consume my API passing info through header, such as:<br>
&gt;&gt;&gt;&gt;&gt;&gt; Authorization, Content-Type, and X-API-Key.<br>
&gt;&gt;&gt;&gt;&gt;&gt; I&#39;m talking about a javascript application. So, CORS is a problem for<br>
&gt;&gt;&gt;&gt;&gt;&gt; that language.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; When I configure my contract to allow Cross-Origin, the error still<br>
&gt;&gt;&gt;&gt;&gt;&gt; there, but if I put my X-API-Key, as a query parameter, the CORS works fine.<br>
&gt;&gt;&gt;&gt;&gt;&gt; Does anyone could help me to understand that?<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; I&#39;m concerned to pass my contract as a query parameter. It should be<br>
&gt;&gt;&gt;&gt;&gt;&gt; on Header of my Http Request.<br>
&gt;&gt;&gt;&gt;&gt;&gt; Please, help me to understand if it is a behaviour of the application<br>
&gt;&gt;&gt;&gt;&gt;&gt; and how can I solve this without use query param.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Best Regards,<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt;&gt;&gt; ---<br>
&gt;&gt;&gt;&gt;&gt;&gt; Celso Agra<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt;&gt;&gt;&gt;&gt; Apiman-user mailing list<br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="mailto:Apiman-user@lists.jboss.org">Apiman-user@lists.jboss.org</a><br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/apiman-user" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/apiman-user</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; --<br>
&gt;&gt;&gt;&gt; ---<br>
&gt;&gt;&gt;&gt; Celso Agra<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; ---<br>
&gt;&gt; Celso Agra<br>
&gt;&gt;<br>
&gt;&gt; ______________________________<wbr>_________________<br>
&gt;&gt; Apiman-user mailing list<br>
&gt;&gt; <a href="mailto:Apiman-user@lists.jboss.org">Apiman-user@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/apiman-user" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/apiman-user</a><br>
&gt;&gt;<br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><span style="font-family:&#39;Times New Roman&#39;;font-size:16px">---<br><b>Celso Agra</b></span></div></div></div></div></div>
</div>