Isso VHost not working

I have this working Nginx configuration in my NixOS config:

  services.nginx = {
    enable = true;
    httpConfig = ''
      server {
        server_name comments.davidak.de;
        location / {
          return 404;
        }
        location /static/js/ {
          alias ${pkgs.isso.js}/;
        }
        location /isso {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header X-Script-Name /isso;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_pass http://localhost:9001;
        }
      }
    '';
  };

I tried to convert this to Caddy but it seams that the proxy VHost don’t work correctly. When i post a comment to Isso, i get a 404 response. Empty error log.

  # Caddy Webserver
  services.caddy = {
    enable = true;
    email = "**********@davidak.de";
    ca = "https://acme-staging.api.letsencrypt.org/directory";
    agree = true;
    config = ''
    import /var/www/*/web/Caddyfile

    comments.davidak.de:80/static/js {
      tls off
      root ${pkgs.isso.js}/
      gzip
    }

    comments.davidak.de:80 {
      proxy /isso localhost:9001 {
        header_upstream X-Script-Name /isso
        transparent
      }
      errors /var/www/davidak/log/isso
    }
    '';
  };

Any idea what could be wrong?

A suggestion to combine this to one VHost? There is no location directive in Caddy.

Assuming you’re using a mostly-stock isso, you’ll want to include the following additional line in your proxy stanza:

without /isso

Otherwise, the proxied URI becomes localhost:9001/isso/…, which probably isn’t what you want.

Rodney

These are the URLs that get’s requested by the embedded comments widget:

http://comments.davidak.de/isso/js/embed.min.js
http://comments.davidak.de/isso/new?uri=/blog/wartezimmer/
http://comments.davidak.de/isso/count

They get a 200 response to the GET and OPTIONS requests.

The POST request to this URL get’s a 404 response:

http://comments.davidak.de/isso/new?uri=/blog/wartezimmer/

So the URLs are correct but i think it’s a caddy issue since it works with nginx.

In my case, isso and Caddy are playing nicely together.

Redacted isso.cfg:

[general]
dbpath = /var/lib/isso/comments.db
name = isso # needs to match X-Script-Name in header
host = http://<myhost>/
       https://<myhost>/
max-age = 15m
notify = smtp
log-file =

[moderation]
enabled = true
purge-after = 30d

[server]
listen = http://127.0.0.1:8081/

[smtp]
username = isso
password = <redacted>
host = localhost
port = 587
security = starttls
to = <my e-mail>
from = "isso comments" <source_addr>
timeout = 10

Relevant part of my Caddyfile:

<myhost> {
    proxy /isso http://127.0.0.1:8081 {
        without /isso
        transparent
        header_upstream X-Script-Name /isso # needs to match name in isso.cfg
    }

Rodney

1 Like

It works after i added it to the VHost of my website instead of a dedicated VHost and added this line:

without /isso

Also added to example repo: add Isso config example by davidak · Pull Request #21 · caddyserver/examples · GitHub

Thanks!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.