0 Replies Latest reply on Feb 8, 2017 6:19 AM by francogar82

    SwitchYard Cors PrefLight - How To



      I cannot be able to execute a call to my BackEnd service (RestEasy) through Chrome because the response is:


      "esponse to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access."





      I inserted a custom RESTEasyContextMapper with override to mapTo using:


      context.setProperty("Access-Control-Allow-Origin", "*").addLabels(new String[]{ EndpointLabel.HTTP.label() });




      httpHeaders.put("Access-Control-Allow-Origin", Arrays.asList("*"));

      httpHeaders.put("Access-Control-Allow-Headers", Arrays.asList("Access-Control-Allow-Origin,origin,name,Content-Type,accept"));

      httpHeaders.put("Content-Type", Arrays.asList("application/json,text/plain,*"));


      But it doesn't work.


      Can you help me please?