1
Build 8747 - SmarterMail doesn't work when running under a virtual directory
Problem reported by Elazar Broad - 12/15/2023 at 9:04 AM
Resolved
My IIS configuration has been the same for a long time, with SmarterMail running under a virtual directory without issue, i.e. www.domain.com/email where /email is the virtual directory. Unless I'm missing something, starting with this build, there's no way to tell Kestrel that it should prepend /email to any resources, resulting in a broken web interface. I did notice a server_url in settings.json, but it doesn't seem to have any effect. Please advise.

Thanks,
 Elazar

2 Replies

Reply to Thread
0
Grady Werner Replied
Employee Post Marked As Resolution
Running SmarterMail under a virtual directory has always been problematic with certain protocols (autodiscover, microsoft-based protocols like EWS, etc). This is why our recommended approach has for a long time been using a combination of mail.example.com and autodiscover.example.com.

It becomes even more so in .NET 8 due to the way paths get rewritten when being returned through Application Request Routing, as well as binding issues with automatic SSL certificates. As such, we can no longer recommend or support running SmarterMail running under a virtual directory. 

As a temporary measure to get things running, you can add a header for X-Forwarded-Prefix into both rewrite rules in web.config (under HTTP_X_Forwarded_Proto), and that should get it running until you have a chance to migrate your setup and URLs. But you'll likely still have issues going forward, and you'll have to add the record back when you upgrade.

The fastest solution is usually to just add a redirect from www.example.com/email to mail.example.com 
Grady Werner SmarterTools Inc. www.smartertools.com
0
Elazar Broad Replied
Hi Grady -
 Thanks! Long story short, I run SmarterMail behind an Apache reverse proxy, so I'm acutely aware of the path issues with EWS etc. - I have multiple mod_rewrite rules configured to handle those. The issue with a dedicated host per-domain is that I have Apache fronting SSL for several domains, all with the same configuration: www.domain.com/email - I'd have to setup separate vhosts (and attendant certificates) for each domain, something that I don't have time for right now.

In the meantime, I've modified appsettings.json to bind Kestrel to a routable IP and I have Apache forwarding requests directly to Kestrel with the X-Forwarded-Prefix header.

Thanks,
 Elazar 

Reply to Thread