Skip to content

snappymail: fix nginx root and /snappymail prefix handling - #690

Closed
Infern1 wants to merge 1 commit into
msimerson:masterfrom
Infern1:snappymail-nginx-prefix
Closed

snappymail: fix nginx root and /snappymail prefix handling#690
Infern1 wants to merge 1 commit into
msimerson:masterfrom
Infern1:snappymail-nginx-prefix

Conversation

@Infern1

@Infern1 Infern1 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Changes proposed in this pull request:

  • snappymail: redirect /snappymail to /snappymail/ so the bare path doesn't fall through to nginx's default root
  • snappymail: correct document root — haproxy does not strip the /snappymail prefix (unlike roundcube and rainloop), so root must be /usr/local/www
  • snappymail: scope the data deny rule to /snappymail/data, which is the URI that actually arrives

With root /usr/local/www, both paths resolve: /snappymail/
/usr/local/www/snappymail/index.php, and assets built from
app_path = "/snappymail"/snappymail/snappymail/v/<ver>/static/...
/usr/local/www/snappymail/snappymail/v/....

Note for existing installs: store_config() won't overwrite an existing
snappymail.conf, so this only helps fresh deploys. roundcube.sh handles
that case with migrate_roundcube_nginx_conf() — happy to add an equivalent
here if you want it, though moving people's configs felt like your call.

Fixes #689

Checklist:

  • docs up-to-date

@msimerson

msimerson commented Aug 5, 2026

Copy link
Copy Markdown
Owner

I can't replicate the issue on an upgrade nor on a completely new build. Without these changes, the install works just fine. Even if it hadn't, changing the root isn't the right way to fix it (rewriting the path in nginx would be better).

@msimerson msimerson closed this Aug 5, 2026
@Infern1

Infern1 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

So I never deployed snappymail, switch to using it, since rainloop is not maintained.
Did a git pull and provisioned snappymail. Running 14.4 FreeBSD. Latest haproxy config

Yesterday I updated to base p8

service jail stop snappymail
Stopping jails: snappymail.
#zfs destroy -f  zroot/jails/snappymail
#zfs destroy -f  zroot/data/snappymail


The gist
https://gist.github.com/Infern1/f87f0505489f70d59521b5ab1545b1d2

And now I retried and it is working, really strange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

snappymail: nginx server block 404s, wrong document root

2 participants