[prev in list] [next in list] [prev in thread] [next in thread] 

List:       forgerock-openidm
Subject:    [OpenIDM]  CORS problem - response header missing
From:       MIRZAIAN Vincent <Vincent.MIRZAIAN () solucom ! fr>
Date:       2015-09-22 12:15:24
Message-ID: AMXPR03MB2947AE471B9045135565475EC450 () AMXPR03MB294 ! eurprd03 ! prod ! outlook ! com
[Download RAW message or body]

Hello,


I have an application which is calling a custom OpenIDM endpoint using CORS=
.

This custom endpoint is returning a message with a status code as follow :


throw {

  "code": 400,

  "message": "My custom error message"

}


The response sent to my application does not contain the "Access-Control-Al=
low-Origin" header therefore the browser thinks that the CORS request faile=
d. My configuration inside the servlet-cors.json seems correct as the prefl=
ight request succeeds.


Instead of the "throw" keyword, if I use the "return" keyword (return { "co=
de" : .... }) , the reponse contains the "Access-Control-Allow-Origin" head=
er but the status code is not correct (always 200).


Is it a bug or am I missing some configuration ?


Any help will be greatly appreciated.


Vincent MIRZAIAN
Consultant
Fixe : +33 (0)1 49 03 87 84
Mobile : +33 (0)6 80 90 51 35
vincent.mirzaian@solucom.fr<mailto:vincent.mirzaian@solucom.fr>
solucom
Tour Franklin : 100 - 101 terrasse Boieldieu
92042 Paris La D=E9fense Cedex

[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} \
--></style> </head>
<body dir="ltr">
<div id="divtagdefaultwrapper" \
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
 <p>Hello,</p>
<p><br>
</p>
<p>I have an application which is calling a custom OpenIDM&nbsp;endpoint using \
CORS.</p> <p>This&nbsp;custom endpoint is returning a message with a status code as \
follow :</p> <p><br>
</p>
<p>throw {</p>
<p>&nbsp; &quot;code&quot;: 400,</p>
<p>&nbsp; &quot;message&quot;: &quot;My custom error message&quot;</p>
<p>}</p>
<p><br>
</p>
<p>The response sent to my application does not contain the \
&quot;Access-Control-Allow-Origin&quot; header therefore the browser thinks that the \
CORS request failed.&nbsp;<span style="font-size: 12pt;">My configuration inside the \
servlet-cors.json</span><span style="font-size: 12pt;">&nbsp;</span><span \
style="font-size: 12pt;">seems&nbsp;</span><span style="font-size: 12pt;">correct  as \
the preflight request succeeds.</span></p> <p><br>
</p>
<p>Instead of the &quot;throw&quot; keyword, if I use the &quot;return&quot; keyword \
(return { &quot;code&quot; : .... })&nbsp;, the reponse contains&nbsp;<span \
style="font-size: 12pt;">the &quot;Access-Control-Allow-Origin&quot; header but the \
status code is not correct (always 200).</span></p> <p><span style="font-size: \
12pt;"><br> </span></p>
<p><span style="font-size: 12pt;">Is it a bug or am I missing some configuration \
?</span></p> <p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">Any help will be greatly appreciated.</span></p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" \
style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0"> \
<b><span style="font-size:8.5pt; \
font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:navy">Vincent \
MIRZAIAN<br> </span></b><span style="font-size:8.5pt; \
font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:#5F5F5F">Consultant<br> \
Fixe : &#43;33 (0)1 49 03 87 84<br> Mobile : &#43;33 (0)6 80 90 51 35<br>
<a tabindex="0" href="mailto:vincent.mirzaian@solucom.fr" id="LPNoLP"><span \
style="color:blue">vincent.mirzaian@solucom.fr</span></a><br> </span><span \
style="font-size:10.0pt; font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; \
color:navy">solucom<br> </span><span style="font-size:8.5pt; \
font-family:&quot;Arial&quot;,&quot;sans-serif&quot;; color:#5F5F5F">Tour Franklin : \
100 - 101 terrasse Boieldieu <br>
92042 Paris La Défense Cedex</span></div>
</div>
</div>
</body>
</html>



_______________________________________________
OpenIDM mailing list
OpenIDM@forgerock.org
https://lists.forgerock.org/mailman/listinfo/openidm

--===============5173047437340597724==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic