[GCR 3.0.0] 404 when accessing a file in a PR

600 views
Skip to first unread message

Tech Advantage

unread,
May 16, 2019, 4:14:25 AM5/16/19
to Repo and Gerrit Discussion
Hi list,

I've migrated our test instance from Gerrit 2.16.7 to 3.0.0.
Additional plugins have been upgraded too (including Javamelody and reviewers)

Unfortunately, when I click a file on a PR to get its content displayed, I got a 404 
An error occurred
Error 404 (Not Found): Not found: src Endpoint: /changes/*~*/revisions/*/files/*/reviewed


The PR itself is correctly displayed at 

but the file URL
results in the 404

As it was an existing pending PR, we tried to create a new but we got the same result.

Any ideas ?

Thanks,
1010

Gert van Dijk

unread,
May 16, 2019, 5:11:56 AM5/16/19
to Repo and Gerrit Discussion
On Thu, May 16, 2019 at 10:14 AM Tech Advantage <a...@tech-advantage.com> wrote:
I've migrated our test instance from Gerrit 2.16.7 to 3.0.0.
Additional plugins have been upgraded too (including Javamelody and reviewers)

Unfortunately, when I click a file on a PR to get its content displayed, I got a 404 
An error occurred
Error 404 (Not Found): Not found: src Endpoint: /changes/*~*/revisions/*/files/*/reviewed


The PR itself is correctly displayed at 

but the file URL
results in the 404


Do you run any reverse proxy in front of Gerrit (e.g. Apache/nginx) or is there a forward proxy you use in your network?
(If nothing changed in that regard, but you only upgraded, proxy configuration mistakes would already yield these errors in 2.16 as far as I know.)

To me this sounds like another encoded slashes issue with a proxy. In case you're using a reverse proxy, please try to disable it temporarily, access Gerrit directly and see if it works without it. If that's the case, I guess you should double check the instructions as per documentation on a reverse proxy configuration. [1]

Tech Advantage

unread,
May 16, 2019, 6:48:03 AM5/16/19
to Repo and Gerrit Discussion


Le jeudi 16 mai 2019 11:11:56 UTC+2, Gert van Dijk a écrit :
On Thu, May 16, 2019 at 10:14 AM Tech Advantage <a...@tech-advantage.com> wrote:
I've migrated our test instance from Gerrit 2.16.7 to 3.0.0.
Additional plugins have been upgraded too (including Javamelody and reviewers)

Unfortunately, when I click a file on a PR to get its content displayed, I got a 404 
An error occurred
Error 404 (Not Found): Not found: src Endpoint: /changes/*~*/revisions/*/files/*/reviewed


The PR itself is correctly displayed at 

but the file URL
results in the 404


Do you run any reverse proxy in front of Gerrit (e.g. Apache/nginx) or is there a forward proxy you use in your network?
(If nothing changed in that regard, but you only upgraded, proxy configuration mistakes would already yield these errors in 2.16 as far as I know.)
We are running it behind NGinx set as a reverse proxy.
It has been running this way since 2.12.

From nginx logs, here are the 404


172.17.10.1 - - [16/May/2019:09:45:38 +0200] "GET /gerrit/bower_components/polymer/lib/legacy/legacy-data-mixin.html HTTP/1.1" 404 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15" "-"
172.17.10.1 - - [16/May/2019:09:45:40 +0200] "PUT /gerrit/changes/sandbox~47/revisions/4/files/src%2Fmain%2Fjava%2Ffr%2Ftechad%2Fsandbox%2FPerson.java/reviewed HTTP/1.1" 404 16 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15" "-"
172.17.10.1 - - [16/May/2019:09:45:40 +0200] "GET /gerrit/changes/sandbox~47/revisions/4/files/src%2Fmain%2Fjava%2Ffr%2Ftechad%2Fsandbox%2FPerson.java/diff?context=ALL&intraline&whitespace=IGNORE_ALL HTTP/1.1" 404 16 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15" "-"

Gerrit listen url is proxy-http://127.0.0.1:8081/gerrit/

nginx proxy configuration is straightforward
        location /gerrit {
                proxy_pass http://127.0.0.1:8081/gerrit;
                proxy_set_header  X-Forwarded-For $remote_addr;
                proxy_set_header  Host $host;
        }


To me this sounds like another encoded slashes issue with a proxy. In case you're using a reverse proxy, please try to disable it temporarily, access Gerrit directly and see if it works without it. If that's the case, I guess you should double check the instructions as per documentation on a reverse proxy configuration. [1]

Direct access is OK : all is fine
gerrit access log with reverse proxy activated show this

172.17.10.1 - redacted [16/May/2019:12:45:01 +0200] "PUT /gerrit/changes/sandbox~47/revisions/4/files/sandbox/src/main/java/fr/techad/sandbox/Person.java/reviewed HTTP/1.0" 404 15 3 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15"
172.17.10.1 - redacted [16/May/2019:12:45:01 +0200] "GET /gerrit/changes/sandbox~47/revisions/4/files/sandbox/src/main/java/fr/techad/sandbox/Person.java/diff?context=ALL&intraline&whitespace=IGNORE_ALL HTTP/1.0" 404 15 3 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15"

Slashes are logged decoded whereas nginx log them as encoded
 

Tech Advantage

unread,
May 16, 2019, 12:40:28 PM5/16/19
to Repo and Gerrit Discussion
It's OK with haproxy instead of nginx.
What is strange is that nothing has changed in the nginx settings...

Gert van Dijk

unread,
May 16, 2019, 2:48:09 PM5/16/19
to Repo and Gerrit Discussion
On Thu, May 16, 2019 at 12:48 PM Tech Advantage <a...@tech-advantage.com> wrote:
nginx proxy configuration is straightforward
        location /gerrit {
                proxy_pass http://127.0.0.1:8081/gerrit;
                proxy_set_header  X-Forwarded-For $remote_addr;
                proxy_set_header  Host $host;
        }

Could you please try again without the /gerrit suffix/URI part in the proxy_pass directive highlighted above? If an URI is omitted, nginx behaves differently compared to when you don't. See also this SO Q&A: [1]. And also the earlier linked documentation on Gerrit on nginx configuration omits it.

Anyway, good to hear that a different reverse proxy does work, so I think it's most likely related to your nginx's behaviour. I can't really explain why this happens after the Gerrit upgrade, though.

HTH

Tech Advantage

unread,
May 17, 2019, 2:05:36 AM5/17/19
to Repo and Gerrit Discussion


Le jeudi 16 mai 2019 20:48:09 UTC+2, Gert van Dijk a écrit :
On Thu, May 16, 2019 at 12:48 PM Tech Advantage <a...@tech-advantage.com> wrote:
nginx proxy configuration is straightforward
        location /gerrit {
                proxy_pass http://127.0.0.1:8081/gerrit;
                proxy_set_header  X-Forwarded-For $remote_addr;
                proxy_set_header  Host $host;
        }

Could you please try again without the /gerrit suffix/URI part in the proxy_pass directive highlighted above? If an URI is omitted, nginx behaves differently compared to when you don't. See also this SO Q&A: [1]. And also the earlier linked documentation on Gerrit on nginx configuration omits it.
Migrating to haproxy for this server was a long-time postponed operation, I'll stick with it now.
However, for the record, I give a try to nginx with a proxy_pass directive without /gerrit and it worked.
Reply all
Reply to author
Forward
0 new messages