XMLHttpRequest cannot load https://[redacted].gitlab.io/trello-power-up/manifest.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://trello.com' is therefore not allowed access.
Considering how GitHub pages allows all origins, we should do the same.
HTTP/1.1 200 OKServer: GitHub.comDate: Thu, 08 Jun 2017 19:09:56 GMTContent-Type: text/html; charset=utf-8Content-Length: 56130Last-Modified: Tue, 02 May 2017 09:38:20 GMTAccess-Control-Allow-Origin: *Expires: Thu, 08 Jun 2017 19:19:56 GMTCache-Control: max-age=600Accept-Ranges: bytesX-GitHub-Request-Id: FEC6:1B600:DC488E:1238FD8:5939A104
I think we mostly have these CORS headers to ensure people don't somehow access the GitLab API in a harmful way. Isn't it possible for someone to include a JavaScript widget on their Pages site that attempts to make an Ajax request to the GitLab API, and the CORS header would block that? https://stackoverflow.com/a/12014554/1992201
It would be nice to have this in time for %9.4. We are building the Trello power up (javascript app) and want to have it deployed in the %9.4 milestone. If we don't have CORs enabled for gitlab pages, I'm going to have to resort to mirroring our repo to github so that I can deploy our new trello power up app in github pages.
Benefits of doing this in 9.4
It would be nice to keep everything within GitLab
Users who poke around the Trello integration will notice that we are dependent on GitHub pages (may lead to community conversations about why GitLab uses GitHub pages for their own stuff)
If we can't do it in %9.4, we can always migrate over from GitHub pages to GitLab pages in the future but it would be nice to skip that step all together if that's possible
I think we mostly have these CORS headers to ensure people don't somehow access the GitLab API in a harmful way. Isn't it possible for someone to include a JavaScript widget on their Pages site that attempts to make an Ajax request to the GitLab API, and the CORS header would block that? https://stackoverflow.com/a/12014554/1992201
@ClemMakesApps we're fine from that point of view - otherwise anyone could set up a web server anywhere in the world that issued some JS and the right headers, link to it, and wait for the results to roll in.
This is about what happens when someone wants access to a resource hosted on *.gitlab.io - generally .json files.
Since there's no resource-modifying endpoints, and no authentication, in the page daemon, I really can't see how this could be a problem, so let's do it.
@nick.thomas@ClemMakesApps Giving this some more thought... it probably needs to be an optional setting. Otherwise we risk exposing content on internally deployed Pages instances behind a firewall.
The setting needs to have a warning that this could allow sites to pull data from instances behind network firewalls or that are otherwise isolated.
@briann if the pages instance is behind a firewall, surely the CORS headers it exposes are of no import whatsoever?
We could add a -disable-cors option, but I don't think it's necessary. We don't make this configurable for the GitLab API itself, where the stakes are far higher.
@briann ahhhh, I see, you're thinking about a site outside the firewall that serves JS which the browser (inside the firewall) executes, which pulls from the pages instance and exfiltrates that data back.
I'll update !33 (merged) to have -disable-cors and open an issue in gitlab-ce to allow the API to be similarly locked down.
@nick.thomas Exactly. The API wouldn't be affected by this, would it? We're not talking about enabling CORS for the GitLab instance or the API, only Pages?