Can not reach the Main Page of my MediaWiki that's behind a reverse proxy server (Caddy). I can only see the Apache2 Default Page

1. Caddy version (caddy version):

v2.4.3 h1:Y1FaV2N4WO3rBqxSYA8UZsZTQdN+PwcoOcAiZTM8C0I=

2. How I run Caddy:

a. System environment:

Debian Linux 10.9 for Caddy and MediaWiki

b. Command:

systemctl reload caddy

c. Service/unit/compose file:

Not applicable

d. My complete Caddyfile or JSON config:

testwiki.nsupdate.info:443 {
        reverse_proxy 192.168.100.5:8080
}

3. The problem I’m having:

The situation is as follows:

I have a MediaWiki installed on a Debian server. The Wiki is installed on Apache2

For information, the changes I made in the LocalSettings.php file is as follows:

$wgScriptPath = "/mediawiki";
$wgServer = "http://192.168.100.5:8080";

In the internal network, when I type in the local IP address of the MediaWiki server (192.168.100.5:8080) I get to the default page of Apache where it says that it works.

But when I type /mediawiki behind it, (192.168.100.5:8080/mediawiki), I get to the main page of the Wiki.

I have put this server behind a reverse proxy (Caddy) so that it’s accessible from the outside world.

The Caddyfile config is as follows:

testwiki.nsupdate.info:443 {
        reverse_proxy 192.168.100.5:8080
}

But when I type in the domain, I can only see the Apache Default page. I also can not get to the MediaWiki if I put /mediawiki behind the URL.

Does anyone know how I can make it so that whenever I go to my domain, that it automatically goes to the main page of the MediaWiki, (which in the local network would be 192.168.100.5:8080/mediawiki as stated earlier).

4. Error messages and/or full log output:

Error message when going to my domain, after changing Caddyfile config. See 5th point:
this site can't be reached - DNS_PROBE_FINISHED_NXDOMAIN.

5. What I already tried:

I tried changing the Caddyfile config to:

testwiki.nsupdate.info:443 {
        reverse_proxy 192.168.100.5:8080/mediawiki/
}

In the hopes that it will redirect to that internal IP address which does work in the local network. But unfortunately, it doesn’t work. When I go to my domain it doesn’t show anything. It just says this site can't be reached - DNS_PROBE_FINISHED_NXDOMAIN.

6. Links to relevant resources:

That means your browser couldn’t resolve your domain to an IP address. Make sure your DNS is correctly configured.

Caddy does not support simultaneously rewriting the path at the same time as proxying. Instead, you should use the rewrite directive to do that, before reverse_proxy handles the request.

rewrite * /mediawiki{uri}

But be aware that mediawiki may still respond to requests with /mediawiki in the links/assets, so rewriting may not work in all cases. This isn’t something Caddy can solve on its own. You’ll need to make sure it’s configured to not have a base path configured if you want to serve it from the root of your subdomain. It’s essentially the inverse of the problem described in this article:

This topic was automatically closed after 30 days. New replies are no longer allowed.