My Jersey [CORS](http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) request is not functioning for POST, but works for GET requests. The headers are being mapped to Jersey requests as shown in the below screenshot of a GET request to the same resource.

However, doing a POST to the below method makes me end up with `XMLHttpRequest cannot load http://production.local/api/workstation. Origin http://workstation.local:81 is not allowed by Access-Control-Allow-Origin.`

**Here's a screenshot of network activity:**
![enter image description here](https://i.stack.imgur.com/GHW05.png)

**Details on failed POST request:**
![enter image description here](https://i.stack.imgur.com/8W0t0.png)

**Here's my resource:**

```
@Path("/workstation")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public class WorkstationResource {

    @InjectParam
    WorkstationService workstationService;

    @POST
    public WorkstationEntity save (WorkstationEntity workstationEntity) {
        workstationService.save(workstationEntity);
        return workstationEntity;
    }

    @GET
    @Path("/getAllActive")
    public Collection<WorkflowEntity> getActive () {
        List<WorkflowEntity> workflowEntities = new ArrayList<WorkflowEntity>();
        for(Workflow workflow : Production.getWorkflowList()) {
            workflowEntities.add(workflow.getEntity());
        }
        return workflowEntities;
    }
}

```

**My CORS filter:**

```
public class ResponseCorsFilter implements ContainerResponseFilter {

    @Override
    public ContainerResponse filter(ContainerRequest request, ContainerResponse response) {

        Response.ResponseBuilder responseBuilder = Response.fromResponse(response.getResponse());
        responseBuilder
                .header("Access-Control-Allow-Origin", "*")
                .header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, HEAD");

        String reqHead = request.getHeaderValue("Access-Control-Request-Headers");

        if(null != reqHead && !reqHead.equals(null)){
            responseBuilder.header("Access-Control-Allow-Headers", reqHead);
        }

        response.setResponse(responseBuilder.build());

        return response;
    }
}

```

My Jersey configuration in my Main class:

```
//add jersey servlet support
ServletRegistration jerseyServletRegistration = ctx.addServlet("JerseyServlet", new SpringServlet());
jerseyServletRegistration.setInitParameter("com.sun.jersey.config.property.packages", "com.production.resource");
jerseyServletRegistration.setInitParameter("com.sun.jersey.spi.container.ContainerResponseFilters", "com.production.resource.ResponseCorsFilter");
jerseyServletRegistration.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", Boolean.TRUE.toString());
jerseyServletRegistration.setInitParameter("com.sun.jersey.config.feature.DisableWADL", Boolean.TRUE.toString());
jerseyServletRegistration.setLoadOnStartup(1);
jerseyServletRegistration.addMapping("/api/*");

```