Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After login/logout redirected to the wrong url #431

Closed
gitblit opened this issue Aug 12, 2015 · 7 comments
Closed

After login/logout redirected to the wrong url #431

gitblit opened this issue Aug 12, 2015 · 7 comments

Comments

@gitblit
Copy link
Owner

@gitblit gitblit commented Aug 12, 2015

Originally reported on Google Code with ID 135

What steps will reproduce the problem?

1. Install the gitblit war in tomcat7
2. Create a symbolic link from webapps/gitblit-x.x.x to webapps/gitblit
3. Setup a subdomain proxy in Apache2 using AJP 
   (with the settings from http://gitblit.com/setup.html), forward the proxy to webapps/gitblit
(not the versioned url)
4. Go to git.mydomain.com and login

What is the expected output? 

Login and be forwarded to
git.mydomain.com/;jsessionid=xxxxx

What do you see instead?

I am forwarded to 
git.mydomain.com/gitblit/;jsessionid=xxxx
leading to a 404 error. When I remove the "/gitblit" part, i am logged in.

What version of the product are you using? On what operating system?

Gitblit: 1.1.0 war
Tomcat7: 7.0.28
Apache2: 2.2.22-11
Debian Wheezy

Please provide any additional information below.

Appearently, somewhere in the code is a forward to the url of the webapp, this should
be a forward to the existing url.

Reported by imeelvanjoost on 2012-09-19 22:06:47

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Using git is working fine using the 'bare' url (https://git.mydomain.com/git/myrepo.git).
However, in the repository-summary view the link is displayed including the extra "/gitblit".

Reported by imeelvanjoost on 2012-09-20 08:51:12

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

I'll start backwards here.

Because the repository url is not a link (it is just text), Apache does not manipulate
the url when the page is proxied.  I will add support for an optional X-Forwarded-Context
so that you can configure Apache to tell Gitblit what the appropriate context path
should be.  These X-Forwarded parameters are only used to generate the repo url.

Login/logout.  Hmmm.  Perhaps you can pass along your config for a subdomain proxy.
 My setup instructions do not include that info.  They assume apache://gitblit and
tomcat://gitblit, i.e. context paths match.  Perhaps there is a bug in Gitblit or perhaps
there is an additional config setting required for Apache.  Don't know as I have never
used subdomain proxying.

Reported by James.Moger on 2012-09-20 13:36:05

  • Status changed: Accepted
  • Labels added: Milestone-1.2.0

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Thanks for your response. In the meanwhile I found a solution for my problem. This also
involves setting up a host in tomcat

The following apache2 vhost maps a domain to the root of the tomcat server.
{{{
<Virtualhost *:443>
    ServerName      git.mydomain.com
    ProxyRequests       Off
    ProxyVia        Off
    ProxyPreserveHost   On
    ProxyPass       /   ajp://localhost:8009/
</Virtualhost>
}}}

In tomcat, add the following host to the server.xml. This makes gitblit the root app,
if the domain is git.mydomain.com
{{{
<Host name="git.mydomain.com" appBase="webapps" unpackWARs="true" autoDeploy="true"
        xmlValidation="true" xmlNamespaceAware="false">
    <Context path="" docBase="gitblit" reloadable="true" privileged="true"
        antiResourceLocking="false" anitJARLocking="false"/>
</Host>
}}}


This however, does not fix an inconsistent url in the repository summary, in fact it
makes it worse.

http://user@192.168.0.100:8080/gitblit/git/myrepo.git

But i supposed implementing x-forwarded-context as you proposed can fix this problem


Reported by imeelvanjoost on 2012-09-20 14:02:39

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Excuse me, my last comment is not right. I had multiple tabs open. One on my domain,
via apache, one directly to the server ip and directly into tomcat. I opened the wrong
one to check if the url was right.

The dual config in apache2 and tomcat completely fixes my problem. X-Forward does not
seem necessary to me any more. Maybe this information could be reflected in the documentation
on the website?

Reported by imeelvanjoost on 2012-09-20 14:09:30

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Tricky.  I pushed the code for X-Fowarded-Context, if you'd like to build from source
and give that a go.  This will only affect the context path, not the host.  Perhaps
you will also need an X-Forwarded-Host.

Reported by James.Moger on 2012-09-20 14:21:39

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Ok cool.

I will update the docs with your findings.

Reported by James.Moger on 2012-09-20 14:23:06

@gitblit
Copy link
Owner Author

@gitblit gitblit commented Aug 12, 2015

Reported by James.Moger on 2013-07-03 14:32:54

  • Status changed: Done
  • Labels removed: Milestone-1.2.0

@gitblit gitblit closed this as completed Aug 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant