Is it possible to set CORS in GERRIT?

302 views
Skip to first unread message

SeongUk Baek

unread,
Mar 22, 2015, 8:02:52 PM3/22/15
to repo-d...@googlegroups.com
Hello.

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?


thanks for the help.

SeongUk Baek

unread,
Mar 23, 2015, 8:10:05 PM3/23/15
to repo-d...@googlegroups.com
Hi guys.

I have got the error : "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'mygerrit.test.com' is therefore not allowed access. "
How do I overcome the problem?

Is it possible to set for CORS? Or is there any other way to resovle it?

Have I missed anything, please advise.

Best regards.
Baek,


Jan Kundrát

unread,
Mar 24, 2015, 6:06:52 AM3/24/15
to repo-d...@googlegroups.com
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/

SeongUk Baek

unread,
Mar 25, 2015, 2:16:15 AM3/25/15
to repo-d...@googlegroups.com
Thank you for your reply.

Solved by modifying the security options of browers.


2015년 3월 24일 화요일 오후 7시 6분 52초 UTC+9, Jan Kundrát 님의 말:
Reply all
Reply to author
Forward
0 new messages