0

I installed Foswiki on a local computer: http://<localcomputer>:<localport>/foswiki.

It works nice for many years. This computer is not reachable by the internet. Now I want to access it from the internet through a reverse Apache2 proxy. Therefor I have a domain name: foswiki.<mydomain.com>. On the proxy server i have:

<VirtualHost *:443>
  ServerName foswiki.<mydomain.com>

  some SSL stuff

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

  ProxyRequests On
  ProxyPreserveHost On
  ProxyPass / http://<localcomputer>:<localport>/foswiki/
  ProxyPassReverse / http://<localcomputer>:<localport>/foswiki/
</VirtualHost>

Using the link on an external computer: https://foswiki.<mydomain.com>, I can see the texts from the front page, but the layout is not OK. The logo is not shown. I tried many things, but not the correct one yet....

The external link is in https. The local link is http. In the source code, as seen with the external https link, there are some href="http://foswiki.<mydomain.com>/foswiki/bin/../pub/*". Note the http in stead of https. These http:// are not working.

Other proxies of the same proxy server are working correctly. They redirect to other computers than the Foswiki installation.

What am I missing?

EDIT: Gerald gave me the answer to get the proxy working with Foswiki. See below.

Now, I have another issue. But If try to solve this myself.

1 Answers1

0

Foswiki has a documentation for the use behind a reverse proxy.

  • Foswiki will detect the X-Forwarded-Host header and will set the {DefaultUrlHost} from this header. It only will work when a single proxy is in-line Multiple proxy hops will break the configuration.
  • If SSL is terminated at the proxy, Foswiki will not detect https:// for the protocol. Override this by adding "?SSL=1" to the initial connection: https://mynewsite.com/Main/WebHome?SSL=1
  • Set the {DefaultUrlHost} to the protocol://hostname used by users to contact the proxy.
  • Set {ForceDefaultUrlHost} to 1
  • Set {Sessions}{UseIPMatching} to 0

So:

tools/configure -save -set {DefaultUrlHost}='https://foswiki.<mydomain.com>'
tools/configure -save -set {ForceDefaultUrlHost}=1
tools/configure -save -set {Sessions}{UseIPMatching}=0

And add ?SSL=1 to your ProxyPass directives.

Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79
  • Thanks Gerald, I did read the Foswiki documentation, but I did not underdstand it correctly. With your explaination, I the proxy works. But now there is another issue. I will edit my starting topic above. (I cannot upvote your answer yet... Sorry!) – Zilvermeeuw Aug 14 '22 at 07:41
  • Please don't edit new issues in your question. Ask a new question for it. – Gerald Schneider Aug 15 '22 at 05:17