Caddy 2: KiwiBNC websocket reverse_proxy

I am having trouble routing KiwiBNC IRC bouncer webchat into a path on my site.

With the config seen below, I can access the webchat via the server IP and port 3001, plain http. I had to use this when I was still using Caddy v1 as well as I was unable to figure out a proper config after some changes in KiwiBNC routing code.

If I try to access it via https://mysite.org/kiwibnc/ I see in my dev tools console I get XHR 404 for https://mysite.org/kiwibnc_plugin.html

Any ideas?

Caddy v2 config:

mysite.org, www.mysite.org {
    encode gzip
    root * /var/www/mysite
    file_server
    route /kiwibnc/* {
        uri strip_prefix /kiwibnc
        reverse_proxy http://127.0.0.1:3001
    }
}

The location of the 404’d file on disk is
/var/www/kiwibnc/src/extensions/webchat/kiwibnc_plugin.html

The source for KiwiBNC’s webchat routing:

KiwiBNC’s config.ini:

[listeners]
# Each listener accepts plain TCP connections, Websocket connections, and HTTP requests if enabled
bind = [
    "0.0.0.0:3001",
]

# Websocket connections will only be allowed from these whitelisted websites
websocket_origins = [
    "https://mysite.org",
    "https://www.mysite.org",
    "http://mysite.org:8080",
    "http://my.ip.add.ress:3001",
]

[webserver]
# A static HTTP server. Handy for serving a web client such as Kiwi IRC
# If the webchat extension is enabled too, Kiwi IRC will automatically be downloaded
# and configured into the public_dir.
enabled = true
base_path = "/"
public_dir = "/var/www/kiwidata/kiwiirc"

[webchat]
# Extra configuration for the Kiwi web interface. The webchat extension must be loaded
# See https://github.com/kiwiirc/kiwiirc/wiki/Configuration-Options
# In exotic server setups or reverse proxies the correct BNC server may not be correctly detected.
# This server option should point to a listener address as configured above.
"startupOptions.websocket" = "wss://mysite.org/kiwibnc/ws/"

It sounds to me like you’re running into the subpath problem, but I’m not certain.

I generally recommend to use a subdomain instead for proxying to other apps.

But I do see that your config.ini has base_path = "/". I think you should be setting that to base_path = "/kiwibnc" maybe?

Thanks, I will look into using a subdomain. Changing the base_path option did not help.

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