On Monday, 23 March 2015 01:02:52 CET, SeongUk Baek wrote:
> I've got error when I run http-request to GERRIT.
> I think, I need to set the CORS set in GERRIT.
>
> Is it possible to set CORS in GERRIT and how can I set?
It is not possible to set it, AFAIK. Based upon a first quick readup, it
seems to me that the public, unauthenticated API *should* be accessible
from everywhere -- there's no reason to make this CORS-protected that I
can see. But I'm not a web developer. Maybe stuff changes when an entire
Gerrit is protected by some HTTP auth?
Anyway, here's what I did for enabling cross-domain access for querying
bug-related data. I had to do it that way because our Gerrit and Bugzilla
run on completely unrelated domains. Using Apache's proxying:
ProxyPassMatch ^/gerrit-query-bug/([0-9]+)$
https://gerrit.vesnicky.cesnet.cz/r/changes/?q=bug:$1 nocanon
<Location /gerrit-query-bug>
ProxyPreserveHost off
Header unset Set-Cookie
RequestHeader unset Cookie
Header set Access-Control-Allow-Origin:
https://bugs.kde.org
</Location>
Hope this helps,
Jan
--
Trojitá, a fast Qt IMAP e-mail client --
http://trojita.flaska.net/