If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Deploy onyx 1.4.14 to staging

VERIFIED FIXED

Status

Content Services Graveyard
Tiles: Ops
VERIFIED FIXED
2 years ago
2 years ago

People

(Reporter: oyiptong, Assigned: kthiessen)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
This release of onyx adds CORS support for API endpoints. More context in bug 1182602.

An easy way to test this is to do:

> $ curl -I -H "Origin: mozilla.org" http://127.0.0.1:5000/v3/links/fetch/en-US/nightly
> HTTP/1.1 303 SEE OTHER
> Server: gunicorn/18.0
> Date: Mon, 13 Jul 2015 14:46:48 GMT
> Connection: keep-alive
> Content-Type: text/html; charset=utf-8
> Content-Length: 0
> Location: https://tiles.cdn.mozilla.net/desktop-prerelease/STAR/en-US.5ab13754ce03fd4acbe6b137e2914b926104f900.ag.json
> Access-Control-Allow-Origin: mozilla.org

The important bits are:

1. the 'origin' header needs to be specified on an outbound request
2. the request yields and expected response (in this case a 303)
3. the server adds an 'Access-Control-Allow-Origin' header

This should work for fetch as well as for the ping endpoints. e.g.

> $ curl -v -H "Origin: mozilla.org" -d '{"locale": "en-US"}' http://127.0.0.1:5000/v3/links/click
> * Hostname was NOT found in DNS cache
> *   Trying 127.0.0.1...
> * Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0)
> > POST /v3/links/click HTTP/1.1
> > User-Agent: curl/7.37.1
> > Host: 127.0.0.1:5000
> > Accept: */*
> > Origin: mozilla.org
> > Content-Length: 19
> > Content-Type: application/x-www-form-urlencoded
> >
> * upload completely sent off: 19 out of 19 bytes
> < HTTP/1.1 200 OK
> * Server gunicorn/18.0 is not blacklisted
> < Server: gunicorn/18.0
> < Date: Mon, 13 Jul 2015 14:49:59 GMT
> < Connection: keep-alive
> < Content-Type: application/json; charset=utf-8
> < Content-Length: 0
> < Access-Control-Allow-Origin: mozilla.org
(Reporter)

Comment 1

2 years ago
Note that the first example request was a GET and the second was a POST.
Both methods are allowed.
(Assignee)

Comment 2

2 years ago
Building via Jenkins ...
Status: NEW → ASSIGNED
(Assignee)

Comment 3

2 years ago
Build failed: https://deploy.mozaws.net/view/Tiles-Onyx/job/Tiles-Onyx-Deploy-NotProd/33/

Daniel, any idea what's going here?
Flags: needinfo?(dthornton)
the jenkins definition of stage moved to a new IAM, and the entire stage environment needs to be redeployed there. This has been done, and this onyx deploy is running again.
Flags: needinfo?(dthornton)
(Assignee)

Comment 5

2 years ago
Thanks, Daniel.  This is deployed in stage: https://deploy.mozaws.net/view/Tiles-Onyx/job/Tiles-Onyx-Deploy-NotProd/36/

Olivier, could you help me spot-check the CORS headers?
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
Flags: needinfo?(oyiptong)
Resolution: --- → FIXED
(Reporter)

Updated

2 years ago
Status: RESOLVED → VERIFIED
Flags: needinfo?(oyiptong)
(Reporter)

Comment 6

2 years ago
Appears to be working:

> $ curl -I -H "Origin: mozilla.org" https://onyx_tiles.stage.mozaws.net/v3/links/fetch/en-US/nightly
> HTTP/1.1 303 SEE OTHER
> Access-Control-Allow-Origin: mozilla.org
> Content-Length: 0
> Content-Type: text/html; charset=utf-8
> Date: Mon, 13 Jul 2015 18:45:37 GMT
> Location: https://tiles-resources-stage-tiless3-8ugtjiv04rwz.s3.amazonaws.com/desktop-prerelease/STAR/en-US.1504f2816536996cf942334eeb7ebca569f121a3.ag.json
> Connection: keep-alive


and

> $ curl -v -d '{"locale": "en-US"}' https://onyx_tiles.stage.mozaws.net/v3/links/click
> * Hostname was NOT found in DNS cache
> *   Trying 54.164.35.176...
> * Connected to onyx_tiles.stage.mozaws.net (54.164.35.176) port 443 (#0)
> * TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
> * Server certificate: *.stage.mozaws.net
> * Server certificate: DigiCert SHA2 Secure Server CA
> * Server certificate: DigiCert Global Root CA
> > POST /v3/links/click HTTP/1.1
> > User-Agent: curl/7.37.1
> > Host: onyx_tiles.stage.mozaws.net
> > Accept: */*
> > Content-Length: 19
> > Content-Type: application/x-www-form-urlencoded
> >
> * upload completely sent off: 19 out of 19 bytes
> < HTTP/1.1 200 OK
> < Content-Type: application/json; charset=utf-8
> < Date: Mon, 13 Jul 2015 18:46:46 GMT
> < Content-Length: 0
> < Connection: keep-alive
> <
> * Connection #0 to host onyx_tiles.stage.mozaws.net left intact
(Assignee)

Updated

2 years ago
Blocks: 1183252
You need to log in before you can comment on or make changes to this bug.