cannot create project with slash(/) in project name

1,254 views
Skip to first unread message

Shubham Chitranshi

unread,
Aug 14, 2013, 6:32:27 AM8/14/13
to repo-d...@googlegroups.com
hello everyone ,

I am trying to create a new project via web ui (admin login) but when i use slash in my project name (eg :- mainProject/subProject) it says 404 not found , the gerrit log file says nothing , but as i can see it is possible to create project with slash in name (https://android-review.googlesource.com/#/admin/projects/) ,
my apache httpd file(gerrit.conf) is :-
<VirtualHost *:8082>
    ServerName localhost

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

    <Proxy *>
          Order deny,allow
          Allow from all
    </Proxy>

<Location /login/>
AuthType Basic
AuthName "Gerrit Code Review"
AuthBasicProvider file
AuthUserFile /etc/httpd/passwords
Require valid-user
</Location>
AllowEncodedSlashes on
ProxyPass / http://localhost:8081/
</VirtualHost>

i have created a user named gerrit and installed gerrit inside , my gerrit.config file (~/etc/gerrit.config):-
[gerrit]
        basePath = git
        canonicalWebUrl = http://localhost:8082/
[database]
        type = mysql
        hostname = localhost
        database = reviewdb
        username = gerrit
[auth]
        type = HTTP
[sendemail]
        smtpServer = localhost
        smtpUser = gerrit
[container]
        user = gerrit
        javaHome = /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre
[sshd]
        listenAddress = *:29418
[httpd]
        listenUrl = proxy-http://*:8081/
[cache]
        directory = cache

my os is centos 6.4

thanks

Doug Kelly

unread,
Aug 14, 2013, 10:53:26 AM8/14/13
to repo-d...@googlegroups.com
On Wednesday, August 14, 2013 5:32:27 AM UTC-5, Shubham Chitranshi wrote:
hello everyone ,

I am trying to create a new project via web ui (admin login) but when i use slash in my project name (eg :- mainProject/subProject) it says 404 not found , the gerrit log file says nothing , but as i can see it is possible to create project with slash in name (https://android-review.googlesource.com/#/admin/projects/) ,
my apache httpd file(gerrit.conf) is :-
<VirtualHost *:8082>
    ServerName localhost

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

    <Proxy *>
          Order deny,allow
          Allow from all
    </Proxy>

<Location /login/>
AuthType Basic
AuthName "Gerrit Code Review"
AuthBasicProvider file
AuthUserFile /etc/httpd/passwords
Require valid-user
</Location>
AllowEncodedSlashes on
ProxyPass / http://localhost:8081/
</VirtualHost>

Sounds like another case for "ProxyPass / http://localhost:8081/ nocanon"

Apache likes to be "helpful" and prevent you from passing encoded slashes to a reverse proxy.  It actually makes sense why they do it, it just causes us problems because we know Gerrit can handle it.  See:

Different versions of Apache do this differently, but on CentOS, the version of Apache they ship requires nocanon.  In 2.4, the option "AllowEncodedSlashes NoDecode" (http://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes) also helps -- nocanon is still a valid parameter to ProxyPass, though.

--Doug

Shubham Chitranshi

unread,
Aug 21, 2013, 4:57:52 AM8/21/13
to repo-d...@googlegroups.com
have tried changing the httpd conf file line
proxypass / http://localhost:8081/ nocanon

but still unable to create project with slashes (/) , another point ,what does the option only serve as parent project do??
do I need to have at least one parent project before i can create sub projects ??

does gerrit accepts slash in project name by default ?
or do i have to edit the ~/site_path/etc/gerrit.conf file?

Magnus Bäck

unread,
Aug 21, 2013, 8:37:52 AM8/21/13
to repo-d...@googlegroups.com
On Wednesday, August 21, 2013 at 04:57 EDT,
Shubham Chitranshi <chitransh...@gmail.com> wrote:

> have tried changing the httpd conf file line
> proxypass / http://localhost:8081/ nocanon

What Apache are you running? Did you also try the AllowEncodedSlashes
and NoDecode options as described earlier in the thread?

> but still unable to create project with slashes (/) , another point
> ,what does the option only serve as parent project do??

Such projects are empty placeholders for permissions and other settings
that its children can inherit from. This is useful if you want a common
set of e.g. permissions to span over a set of projects.

> do I need to have at least one parent project before i can create sub
> projects ??

All projects inherit from All-Projects, which is created for you when
Gerrit is installed. You can create 'real' projects that inherit
directly from All-Projects.

> does gerrit accepts slash in project name by default ?
> or do i have to edit the ~/site_path/etc/gerrit.conf file?

Gerrit itself always allows slashes. Your problem must be an encoding
issue.

--
Magnus Bäck
ba...@google.com

Lumír Jasiok

unread,
Aug 22, 2013, 2:40:11 AM8/22/13
to repo-d...@googlegroups.com
Try following section in Apache config file:

  ProxyVia Off

  ProxyPreserveHost On

  RewriteEngine on

  #RewriteRule ^(.*) - [E=SM_USER:%{LA-U:REMOTE_USER}]

  AllowEncodedSlashes NoDecode

  RewriteRule ^/(.*) http://127.0.0.1:8081/$1 [NE,P]


 Most important is AllowEncodedSlashes option.

Best Regards

Lumir Jasiok


Dne středa, 14. srpna 2013 12:32:27 UTC+2 Shubham Chitranshi napsal(a):

Shubham Chitranshi

unread,
Aug 22, 2013, 1:36:12 PM8/22/13
to repo-d...@googlegroups.com
hey lumir thanks for the config help,
but the problem is apache says that the AllowEncodedSlashes can only be on or off so i put it to off , and then i try the create project and a error message appears "404 not found", i have seen my apache error_log and gerrit logs for any clue bt both tend to show nothing . where possibly am i going wrong?

Shubham Chitranshi

unread,
Aug 22, 2013, 1:41:53 PM8/22/13
to repo-d...@googlegroups.com
yes i have tried the AllowEncodedSlashes NoDecode but the apache refuses to start saying it can be only on or off.
also i have this doubt that there is another .conf file in my conf.d folder under etc/httpd set for another port . but does it causes any sort of conflict?
i know its not gerrit issue but i think that may be a cause?

Steffen Gebert

unread,
Aug 23, 2013, 3:19:53 AM8/23/13
to Shubham Chitranshi, repo-d...@googlegroups.com
Hi.

Don't use mod_rewrite - that was only a temporary recommendation.

Use the setup described in Gerrit 2.6+ docs.

Steffen



Shubham Chitranshi <chitransh...@gmail.com> schrieb:
>yes i have tried the AllowEncodedSlashes NoDecode but the apache
>refuses to
>start saying it can be only on or off.
>also i have this doubt that there is another .conf file in my conf.d
>folder
>under etc/httpd set for another port . but does it causes any sort of
>conflict?
>i know its not gerrit issue but i think that may be a cause?
>
>On Wednesday, 21 August 2013 18:07:52 UTC+5:30, Magnus Bäck wrote:
>>
>> On Wednesday, August 21, 2013 at 04:57 EDT,
>> Shubham Chitranshi <chitransh...@gmail.com <javascript:>> wrote:
>
>>
>> > have tried changing the httpd conf file line
>> > proxypass / http://localhost:8081/ nocanon
>>
>> What Apache are you running? Did you also try the AllowEncodedSlashes
>
>> and NoDecode options as described earlier in the thread?
>>
>> > but still unable to create project with slashes (/) , another point
>
>> > ,what does the option only serve as parent project do??
>>
>> Such projects are empty placeholders for permissions and other
>settings
>> that its children can inherit from. This is useful if you want a
>common
>> set of e.g. permissions to span over a set of projects.
>>
>> > do I need to have at least one parent project before i can create
>sub
>> > projects ??
>>
>> All projects inherit from All-Projects, which is created for you when
>
>> Gerrit is installed. You can create 'real' projects that inherit
>> directly from All-Projects.
>>
>> > does gerrit accepts slash in project name by default ?
>> > or do i have to edit the ~/site_path/etc/gerrit.conf file?
>>
>> Gerrit itself always allows slashes. Your problem must be an encoding
>
>> issue.
>>
>> --
>> Magnus Bäck
>> ba...@google.com <javascript:>
>>

Phil Hord

unread,
Aug 23, 2013, 5:38:28 AM8/23/13
to Shubham Chitranshi, Repo and Gerrit Discussion


On Aug 22, 2013 4:29 PM, "Shubham Chitranshi" <chitransh...@gmail.com> wrote:
>
> hey lumir thanks for the config help,
> but the problem is apache says that the AllowEncodedSlashes can only be on or off so i put it to off , and then i try the create project and a error message appears "404 not found", i have seen my apache error_log and gerrit logs for any clue bt both tend to show nothing . where possibly am i going wrong?

Did you try "On"?

Phil

Shubham Chitranshi

unread,
Aug 26, 2013, 12:42:45 AM8/26/13
to repo-d...@googlegroups.com, Shubham Chitranshi

hey Phil thanks for pointing this out,
it works , but what i m unable to understand is that Gerrit understands slashes in the url request, then why does apache needs to encode it ?
anyhow it worked, maybe gerrit expects encoded slashes.

thanks
Shubham Chitranshi

thanks
Shubham Chitranshi

Edwin Kempin

unread,
Aug 26, 2013, 2:49:01 AM8/26/13
to Shubham Chitranshi, Repo and Gerrit Discussion



2013/8/26 Shubham Chitranshi <chitransh...@gmail.com>
Gerrit uses both, slashes and encoded slashes, in its URLs.

 

thanks
Shubham Chitranshi

thanks
Shubham Chitranshi

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages