Tags:
create new tag
view all tags

Question

I installed TWiki behind a reverse proxy but it seems that it does not automatically replace the url from the host with the url from the rp. After adding the following lines to TWiki.pm most things works fine except Attach:

TWiki.pm, 1264:
        # URL convertion for TWiki when accessed via a reverse proxy.
        if ( $ENV{'HTTP_X_FORWARDED_HOST'} ) {
             $this->{urlHost} = "https://".$ENV{'HTTP_X_FORWARDED_HOST'};
        }

Unfortunately I get some uninitialized values in Upload.pm and the browser message " Either you did not specify a file name, or the file you are trying to upload "" has no content. You may not upload an empty file.". It works without reverse proxy.

Is there any recommended way to use TWiki behind a reverse proxy?

Environment

TWiki version: TWikiRelease04x00x03
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian 3.1, kernel 2.6.15
Web server: Apache 2.2.2
Perl version: 5.8.4
Client OS: Linux, Windows
Web Browser: Firefox, IE
Categories: Installation

-- ThomasWeber - 05 Jul 2006

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

As far as I remember a reverse proxy can also be setup so it is totally transparent to the webserver and the user that traffic is proxy'ed. Perhaps this is best solved externally to TWiki?

-- SteffenPoulsen - 07 Jul 2006

Ok this patch is definately no longer necessary, TWiki4 works fine behind a reverse proxy. I found a patch for the apache reverse proxy module. It works now.

-- ThomasWeber - 19 Jul 2006

could you please provide a pointer to the apache reverse proxy module patch?

-- WillNorris - 19 Jul 2006

I have made some progress in running TWiki4 behind a reverse proxy: the biggest step forwards was to use Apache 2.2.2 and mod_proxy_html 2.5 rather than the Debian Sarge versions I was trying to use before. Previously, I kept getting the real hostname appearing in the location bar rather than the proxy host, but the stated versions of Apache and mod_proxy_html fix that. I now have three problems that I strongly suspect are related:

  • A minor problem is that all the fonts appear slightly larger. I thought at first I was missing a style sheet, but the styles are there, just a different size font.
  • A second minor problem is that the images (coloured squares) next to the list of webs in the LH bar are broken images, and that in turn is because the hostname has been stripped from the image URL (it is simply http://path/to/image/file).
  • Finally, the "Edit" and "WYSIWYG" links at the top right of every page similarly have the hostname stripped from the link URL, although - oddly - "Attach" and "Printable" links are fine

I'm intrigued as to why a very few specific links should be broken in this way - can anyone shed any light on this?

-- KeithEdmunds - 05 Aug 2006

twiki website hands back a base href tag that causes most of the site including the style sheet to act like it is coded with absolute URLs. To maintain connections through the HTTPS reverse proxy front-end use mod-proxy-html.

<LOCATION _moz-userdefined="">
        [[SetOutputFilter][]]</LOCATION>

<LOCATION _moz-userdefined=""> [[SetOutputFilter][<Location /twiki/>]]</LOCATION>

<LOCATION _moz-userdefined=""> SetOutputFilter proxy-html
        [[ProxyHTMLURLMap][ProxyHTMLURLMap]] http://host https://host </LOCATION>

<LOCATION _moz-userdefined=""> [[https://host][</Location>]]
</LOCATION>

-- JosephMarceau - 28 Sep 2006

I'm having trouble with the syntax of the above comment. I'm pretty sure that it is what I need to know though. Can anyone post a sample Location block with the hostnames sanitized? I'm working with the following stanza which fails to succeed in a most entertaining way.

ProxyPass /wiki/ http://wikihost/twiki/
<Location /wiki/>
  SetOutputFilter proxy-html
  ProxyHTMLURLMap / /wiki/
  ProxyHTMLURLMap http://wikihost/twiki/ https://securehost/wiki/
</Location>

Twiki version 4 on CentOS 4 for the wikihost. Apache 2.0 Apache 2.2 and mod-proxy-html version 2.5 for securehost.

-- AlexLovellTroy - 05 Jan 2007

I think there is a problem with the /pub subdirectory not being passed or mapped right, but I can't figure out why.

-- AlexLovellTroy - 23 Jan 2007

Closing after more than 30 days. Please reopen with more details if needed...

-- PeterThoeny - 02 Mar 2007

i try to run twiki (4.0.5 on debian etch) behind a https reverse proxy (apache 2.2 https://extern.domain/) with the destination http://intern/cgi-bin/twiki/view/ nearly everything works but i have troubles with the "save"-links. the situation is as follows: after i edit any page i an click "save" my browser tells me i'm reverted to an unsecure page, and i get a "404" but my browser still showes the right https-url (https://extern/cgi-bin/twiki/save/...).

the vhost-config of the reverse proxy looks like:

ProxyPass / http://intern/
  ProxyPassReverse    /       http://intern/
  SetOutputFilter      proxy-html
  ProxyHTMLURLMap      http://extern  https://extern

the essential part of the vhost-config of the intern host:

  RewriteEngine On
  RewriteRule ^/$ /cgi-bin/twiki/view/ [PT] [L]

i also set DefaultUrlHost to https://extern

what am i missing?

tia

-- LordVader - 05 Nov 2007

Closing this support question after more than 30 days of inactivity. Please feel free to re-open if needed.

-- PeterThoeny - 01 Jan 2008

Edit | Attach | Watch | Print version | History: r15 < r14 < r13 < r12 < r11 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r15 - 2008-01-01 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.