title: No 'Access-Control-Allow-Origin' header is present on the requested resource - Resteasy
body: <p>I am working on a webapplication comprises UI-Angular , Server-Java , RestEasy 3.0.9.Final for rest api calls</p>
  
  <p>When i tried to access the rest service from another domain am getting below error</p>
  
  <p><strong>CANNOT LOAD Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost:8080" rel="noreferrer">http://localhost:8080</a>' is therefore not allowed access.</strong></p>
  
  <p>I configured my server side to respond with the cross domain calls and this is working with the GET Call but POST Call is creating ERROR</p>
  
  <p><strong>web.xml</strong></p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;resteasy.providers&lt;/param-name&gt;
      &lt;param-value&gt;com.test.sample.app.CorsFeature&lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;listener&gt;
      &lt;listener-class&gt;
          org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  
  &lt;listener&gt;
      &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
  &lt;/listener&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;resteasy-servlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;
          org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;javax.ws.rs.Application&lt;/param-name&gt;
          &lt;param-value&gt;com.test.sample.app.Application&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/servlet&gt;
  
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;resteasy-servlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/rest/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;context-param&gt;
      &lt;param-name&gt;resteasy.servlet.mapping.prefix&lt;/param-name&gt;
      &lt;param-value&gt;/rest&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;resteasy.scan&lt;/param-name&gt;
      &lt;param-value&gt;true&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p><strong>Service class</strong></p>
  
  <pre><code>@GET
  @Path("/getnameAtt")
  @Produces(MediaType.APPLICATION_JSON)
  public Response getHostnameAttributes() {
  return Response
  .status(200)
  .header("Access-Control-Allow-Origin", "*")
  .header("Access-Control-Allow-Headers",
          "origin, content-type, accept, authorization")
  .header("Access-Control-Allow-Credentials", "true")
  .header("Access-Control-Allow-Methods",
          "GET, POST, PUT, DELETE, OPTIONS, HEAD")
  .header("Access-Control-Max-Age", "1209600")
  .entity(new TestImpl().getHostNameAttributes())
  .build();
  }
  
  @POST
  @Path("/getSeq")
  @Produces(MediaType.APPLICATION_JSON)
  public Response getCurrentSequence(String request) {
  return Response
  .status(200)
  .header("Access-Control-Allow-Origin", "*")
  .header("Access-Control-Allow-Headers",
          "origin, content-type, accept, authorization")
  .header("Access-Control-Allow-Credentials", "true")
  .header("Access-Control-Allow-Methods",
          "GET, POST, PUT, DELETE, OPTIONS, HEAD")
  .header("Access-Control-Max-Age", "1209600")
  .entity(new TestImpl().getCurrentSeq(request))
  .build();
  }
  </code></pre>
  
  <p>Since i am new to resteasy not able to figure out why this was not working.
  Any help would be greatly appreciated . Waiting for your response.</p>
  
  <p>Thanks</p>