Bug 1019540 - Fix CORS headers added to exception responses
Summary: Fix CORS headers added to exception responses
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: PressGang CCMS
Classification: Community
Component: REST-API
Version: 1.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 1.2
Assignee: Lee Newson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-16 03:03 UTC by Matthew Casperson
Modified: 2014-08-04 22:27 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-10-17 23:44:39 UTC
Embargoed:


Attachments (Terms of Use)

Description Matthew Casperson 2013-10-16 03:03:37 UTC
In order for a JavaScript client to read custom headers, like X-PressGang-Version (which is critical to allowing the client to fail over), the Access-Control-Allow-Origin and Access-Control-Expose-Headers headers need to be set.

Right now, Access-Control-Allow-Origin is set to *. This needs to be fixed to use the CORS filter.

Comment 1 Lee Newson 2013-10-16 07:42:38 UTC
Fixed the headers properly in 1.2-SNAPSHOT build 201310161728.

The problem was caused by the way resteasy handles exceptions. When resteasy catches an exception it completely creates a new HTTP Response which means that any headers set by a filter upstream of the request will be lost. As such I've setup the exception mappers to copy the headers from the original response into the new error response.

Comment 3 Matthew Casperson 2013-10-16 20:51:25 UTC
Confirmed that HTTP error responses include the required headers.


Note You need to log in before you can comment on or make changes to this bug.