Absolute path used for _diff #280

Open
candlerb opened this Issue Dec 19, 2011 · 5 comments

Comments

Projects
None yet
3 participants

I have gitit running behind an Apache reverse proxy, so the URLs appear as e.g. http://x.x.x.x/wiki/

This mostly works fine. I can navigate to page history e.g.: http://x.x.x.x/wiki/_history/Front%20Page

However on the history when I drag one revision onto another I get a 404 error, and the URL bar shows the following: http://x.x.x.x/_diff/Front%20Page?from=xxxx&to=xxxx

Manually inserting the /wiki/ back into the URL makes the diff display correctly.

Version:

gitit version 0.8.1 +plugins
Copyright (C) 2008 John MacFarlane
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.
Owner

jgm commented Dec 19, 2011

Did you follow the instructions at
http://gitit.net/README#proxying-to-httpmysite.comwiki
(using mod_proxy_html)?

+++ Brian Candler [Dec 19 11 09:08 ]:

I have gitit running behind an Apache reverse proxy, so the URLs appear as e.g. http://x.x.x.x/wiki/

This mostly works fine. I can navigate to page history e.g.: http://x.x.x.x/wiki/_history/Front%20Page

However on the history when I drag one revision onto another I get a 404 error, and the URL bar shows the following: http://x.x.x.x/_diff/Front%20Page?from=xxxx&to=xxxx

Manually inserting the /wiki/ back into the URL makes the diff display correctly.

Version:

gitit version 0.8.1 +plugins
Copyright (C) 2008 John MacFarlane
This is free software; see the source for copying conditions.  There is no
warranty, not even for merchantability or fitness for a particular purpose.

Reply to this email directly or view it on GitHub:
#280

Yes I followed those instructions, with minor tweaks:

$ dpkg-query -l | grep proxy
ii  libapache2-mod-proxy-html                       3.0.1-1                           Apache2 filter module for HTML links rewriti
$ grep compress my.conf
compress-responses: no
# specifies whether HTTP responses should be compressed.
$ cat /etc/apache2/conf.d/gitit.conf 
# These commands will proxy /wiki/ to port 5001

ProxyRequests Off

<Proxy *>
  Order deny,allow
  Allow from all

  AuthName "Nagios Access"
  AuthType Basic
</Proxy>

ProxyPass /wiki/ http://127.0.0.1:5001/

<Location /wiki/>
  AuthName "Nagios Access"
  AuthType Basic
  AuthUserFile /etc/nagios3/htpasswd.users
  require valid-user

  SetOutputFilter  proxy-html
  ProxyPassReverse /
  ProxyHTMLURLMap  /   /wiki/
  RequestHeader unset Accept-Encoding
</Location>

RedirectMatch ^/wiki$ /wiki/

Looking at HTML source in the browser, the problem appears to be with the 'diffurl' attribute, since this is what the Javascript drag-drop code looks up.

<ul class="history">
  <li class="difflink" order="7" revision="xxxx" diffurl="/_diff/Front Page">
    <span class="date">2011-12-05 11:43:19 UTC</span>
    (<span class="author"><a href="/wiki/_activity?forUser=brian">brian</a></span>):
    <a href="/wiki/Front%20Page?revision=xxxx">
      <span class="subject">...etc

I suspect that mod_proxy_html cannot rewrite these.

I was wrong: you can add

ProxyHTMLLinks        li              diffurl

although you also have to add all the ProxyHTMLLinks settings from http://apache.webthing.com/svn/apache/filters/proxy_html/proxy_html.conf

Once you do this, the diff drag-and-drop works. This may be worth a mention in the documentation for proxying-to-httpmysite.comwiki

Contributor

rekado commented Jan 14, 2014

@candlerb Thank you, this was very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment