Not logged in. · Lost password · Register
Forum: General Help and Support Server Setup RSS
dokuwiki with caddy reverse proxy
niklasdahlheimer #1
Member since Mar 2018 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: dokuwiki with caddy reverse proxy
Hey guys,

My dokuwiki is working allright inside our network. But to make it reachable from outside, I need to setup a reverse proxy.

I've setup the following parameters in the config
$conf['baseurl']  = ''
$conf['useslash'] = 1
$conf['userewrite']  = 1;

my htaccess says:

RewriteEngine on

RewriteRule ^_media/(.*)              lib/exe/fetch.php?media=$1  [QSA,L]
RewriteRule ^_detail/(.*)             lib/exe/detail.php?media=$1  [QSA,L]
RewriteRule ^_export/([^/]+)/(.*)     doku.php?do=export_$1&id=$2  [QSA,L]
RewriteRule ^$                        doku.php  [L]
RewriteCond %{REQUEST_FILENAME}       !-f
RewriteCond %{REQUEST_FILENAME}       !-d
RewriteRule (.*)                      doku.php?id=$1  [QSA,L]
RewriteRule ^index.php$               doku.php

my caddy reverse proxy settings are: {
    proxy / {
        header_upstream Host {host}
        header_upstream X-Real-IP {remote}
        header_upstream X-Forwarded-For {remote}
        header_upstream X-Forwarded-Proto {scheme}
    log / proxylogfile_vht

The dokuwiki is showing up, but without any css-style or images.
I know that this been a topic before, but all the tipps didn't work out, so I started a new topic.
schplurtz (Moderator) #2
Member since Nov 2009 · 511 posts · Location: France, Finistère
Group memberships: Global Moderators, Members
Show profile · Link to this post
This seems to be a classic URL path problem:
proxy /
inside your local net, DokuWiki is accessible at
from outside, it is accessible at .
ie, inside : /dokuwiki, outside : /
This difference in path leads to problems with all web applications, not only DW.
Here is why :

Dokuwiki has to choose an URL for CSS, and other things. Since it runs at
/dokuwiki, it chooses to generate /dokuwkiki/whatever. Unfortunately,
this only works inside your network, not from the outside. Because of the
reverse proxy, /dokuwiki/whatever ends up in /dokuwiki/dokuwiki/whatever
on the worker.

The most simple fix is to add this in DW conf/local.php config file :

This will tell DW that it is accessible at /, and it will generate correct URL
for style and images. You may have to clear your browser's cache.

But there is a drawback : styles and other files will no longer work with direct
access via because of the same URL
path problem, only in the other way.
All access have to go through the reverse proxy, even from the inside.

If you need both access, you shall not set $conf['basedir'] at all and
either install your DW at / on the worker, or play with various rewrite techniques
either on the reverse proxy or on the worker. For example you could try to
rewrite dokuwiki/dokuwiki to dokuwiki on the worker before the other rewriting
RewriteRule ^dokuwiki/dokuwiki($|/.*) dokuwiki$1
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-02-17, 07:59:27 (UTC +01:00)