Bug 1666031

Summary: CORS prevents use of REST API
Product: [Community] Bugzilla Reporter: Stephen Finucane <stephenfin>
Component: WebServiceAssignee: PnT DevOps Devs <hss-ied-bugs>
Status: CLOSED DUPLICATE QA Contact: tools-bugs <tools-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 5.0CC: khong, qgong
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-14 22:34:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stephen Finucane 2019-01-14 17:15:37 UTC
Description of problem:
I'm developing a dashboard that consumes data from the new REST API added in BZ5.

  https://github.com/stephenfin/bugzilla-dashboard

However, I'm forced to deploy this application interally (http://file.emea.redhat.com) due to CORS issues. This shouldn't be necessary for a public REST API.

Version-Release number of selected component (if applicable):
N/A

How reproducible:
Always.

Steps to Reproduce:
1. Make an AJAX call to 'https://bugzilla.redhat.com/rest/bug'

Actual results:
I see the following error in my console:

    Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://bugzilla.redhat.com/rest/bug?component=openstack-nova. (Reason: CORS request did not succeed).

Expected results:
The call should work.

Additional info:
The response should include the following header, allowing users to build tooling that uses the REST API.

    Access-Control-Allow-Origin: *

Comment 1 Stephen Finucane 2019-01-14 17:18:39 UTC
> Additional info:
> The response should include the following header, allowing users to build tooling that uses the REST API.
> 
>     Access-Control-Allow-Origin: *

I should note, in case it wasn't obvious, that we clearly only need this header set for responses from the '/rest' path and subpaths.

Comment 2 Jeff Fearn 🐞 2019-01-14 22:34:51 UTC

*** This bug has been marked as a duplicate of bug 1641232 ***