Help with reverse_proxy with/for php-wiki

1. The problem I’m having:

Trying to setup reverse_proxy for php-based wiki running on a second local server. Wiki is displayed, but layout is corrupted. I’m not sure if caddy have to be configured to display php, instead of “normal” reverse_proxing

2. Error messages and/or full log output:

Jun 25 17:09:08 caddy caddy[2157]: {"level":"error","ts":1750871348.3049283,"logger":"http.log.error","msg":"dial tcp 192.168.178.55:80: i/o timeout","request":{"remote_ip":"91.231.89.96","remote_port":"53455","proto":"HTTP/1.1","method":"GET","host":"wiki.almeida.dedyn.io","uri":"/pmwiki.php/Main/ThinkPadX60","headers":{"Connection":["close"],"User-Agent":["Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:134.0) Gecko/20100101 Firefox/134.0"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.5"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"","server_name":"wiki.almeida.dedyn.io"}},"duration":3.001148605,"status":502,"err_id":"r214vucp5","err_trace":"reverseproxy.statusError (reverseproxy.go:1272)"}

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

3. Caddy version:

caddy v 2.6.2

4. How I installed and ran Caddy:

debian apt installed, runnig by systemd

a. System environment:

debian bookworm , systemd, running as proxmox Container

b. Command:

caddy start, etc, but starting automated by systemd 
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

c. Service/unit/compose file:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

d. My complete Caddy config:

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.

wiki.almeida.dedyn.io {
	reverse_proxy 192.168.178.55:80 {
}

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

5. Links to relevant resources:

Your Caddy instance is not able to talk to your second server192.168.178.55, port 80. Check your other server to make sure there’s nothing blocking such traffic. For example, a local firewall on that server or some ACLs preventing Caddy taking to your PHP server.

1 Like

Hi, sorry I’m a noob with caddy and programming…
But site is displayed and I can move through the posts, only layout is not correct.

I assume the style-sheets and templates are not accessible. There is no firewall. "web"server is netbsd 9.3.
I’ll try to ckeck the lighttpd config ->error.log: 2025-06-22 01:16:56: (connections.c.716) invalid request-line → sending Status 400 (192.168.178.36)
I suppose something from caddy is disliked by netbsd/lighttpd

From the server where you’re running Caddy, run this command and copy-paste the response here:

curl -v http://192.168.178.55

Can you also describe how you’re browsing that site? What does it show in your browser’s address bar?

1 Like

nope, lighttpd is displaying 3x websites with module vhost. curl only sees 1x of them - the wrong one.
I’ll try to make the php-based to standard…

Y can browse it, too: https://wiki.almeida.dedyn.io . Template should be “minimous”, but it isn’t working -->like https://www.pmwiki.org/pmwiki/uploads/Skins/minimous_screenshot.jpg

I can’t access it. I’m getting an HTTP 502 error, same as what you’re seeing in your error log.

Could you clarify a few things? Specifically:

  1. What’s the vhost name configured in lighttpd?
  2. What exact URL is showing in your browser’s address bar when you’re trying to access the site?
  3. If the URL includes a server name, can you try resolving it and share the IP address?

You haven’t answered these questions yet, and without that info, it’s hard to troubleshoot properly. I have a couple of ideas about what might be happening, but I need those details first to help you further.

1 Like

OK, something’s changed since the last time I tried your wiki site. Before, I was getting an HTTP 502 error. Now, I’m seeing this content:

That’s good, it’s definitely progress since it’s no longer showing a 502.

It’s getting late for me, so I’m heading to bed now, but I’ll take another look at this when I’m up. Unless someone else helps you in the meantime!

1 Like

sorry, I set php-wiki in config to “front”. locally it is displayed correctly

to1:

##
$HTTP["host"] == "(wiki\.almeida\.dedyn\.io|blog\.almeida\.dedyn\.io|beos\.almeida\.dedyn\.io)$" {
    simple-vhost.server-root    = "/var/www/servers"

## bei bedarf auszug: |mac-lc\.uk\.to|
#    simple-vhost.document-root = "/"
#    simple-vhost.default-host  ="almeida.dedyn.io"

$HTTP["host"] == "wiki.almeida.dedyn.io" {
    server.document-root="/var/www/servers/wiki.almeida.dedyn.io"
    }

to2:

to3:
CNAME

name:
wiki.almeida.dedyn.io

address:

ttl:
3568

A

name:
almeida.dedyn.io

address:
84.144.237.233

ttl:
3600

Btw: this was an older log, where i try to setup caddy with transport fastcgi.
Now there is no error in logfile

You’re exactly right.

Your wiki page is being served over HTTPS, but the HTML generated by your backend has hardcoded absolute URLs using HTTP. For example:

<link rel="stylesheet" type="text/css" href="http://wiki.almeida.dedyn.io/pub/lib/pmwiki-core.css" />
<script type="text/javascript"  src="http://wiki.almeida.dedyn.io/pub/lib/pmwiki-lib.js"></script>
<title>wiki Main/Home Page</title>
<link rel="stylesheet" type="text/css" href="http://wiki.almeida.dedyn.io/pub/skins/minimous/style.css" media="screen" title="style (screen)" />
<link rel="stylesheet" type="text/css" href="http://wiki.almeida.dedyn.io/pub/skins/minimous/color-copper.css" media="screen" title="style (screen)" />

Browsers don’t like that .. it’s called a mixed content issue.

If you check your browser’s console, you’ll see a bunch of these warnings:

So, what can you do? The PmWiki Troubleshooting page covers this

They mention this situation specifically:

After some upgrades to website, hosting, or browser, some skin styles/colors and possibly local styles, recipes, and embedded pictures, have stopped working.

In your local configuration, if you have the variables $PubDirUrl or $FarmPubDirUrl defined with the http:// scheme, replace them with https://. On secure websites, recent browser versions do not load resources from insecure URLs.

Switching those URLs to HTTPS should solve the issue.

2 Likes

Great, thats the difference if a pro helps - I never suppose that simple “s” does the trick… Thx a lot works :+1:

1 Like