by Devin Yang
(This article was automatically translated.)

Published - 1 year ago ( Updated - 1 year ago )

This article explains the version of DSM7.
The Package Center of Synology Nas provides two Mail Servers, one is Synology Mail Server and the other is Synology MailPlus.
For me, the advantage of Synology MailPlus is that he can easily specify a domain name in the login portal, but it is limited to a maximum of five accounts, and if there are more accounts, you will have to buy a license.
If you use Synoloyg Mail Server, there will be no limit on the number of accounts, but it does not have an integrated login portal. If you install the webmail of Mail Station,
There will be a path of /mail in the directory of the website. Although it is not in the way, I just don't like it.

Good news, my Synology Nas is not directly external, I have a HAProyx to guide related services.
So through a simple setting, I can remove /mail, and automatically fill in the /mail folder when sending the request to the backend through the Proxy.
As shown in the picture below, have you noticed that the URL does not have a /mail path:

After logging in, you can see that the URL path below is also without /mail path:p

Sending letters to Gmail also looks normal😛

How do I set up HAProxy?
1. First, define the domain name of my WebMail: (The following is the relevant setting of my HAProxy)

acl nas_mail_url hdr_beg(host) -i mail.e-course.app mail.ccc.tc
use_backend nasmail if nas_mail_url

Here it is defined that when a URL is mail.e-course.app or mail.ccc.tc, the backend of nasmail is used.

2. In the backend of HAProxy, I did this. Here acl and http-request are the focus of this article.

    backend nasmail
       mode http
       balance roundrobin
       fullconn   10000
       cookie SITEID insert indirect nocache
       acl mail_folder path_beg -i /mail/
       http-request set-path /mail/%[path] if !mail_folder
       server nasmail 192.168.99.130:80

The meaning of http-request set-path here means that if there is no /mail/ in the path of the URL, /mail/ will be added.
If you have made the relevant settings, but the result still automatically ran out of the /mail folder, it is speculated that the possible reason is caused by the browser cache.
You can try to clear the browser data, or verify with another browser to see if the settings are correct.

Tags: Synology haproxy

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


git,Synology

Sharing about gitlab's docker settings

My friend wants to study the operation of gitlab. I said that it takes less than ten minutes to install it with docker image. There is also a gitlab package on my Synology Nas that can be installed directly. As a result, either the installation failed, or it was being repaired, or it was already started and could not be used. @@ Also choked by friends...

fastapi,haproxy

HAProxy and fastapi

HAProxy can use the definition of acl to determine which backend the request should direct to. This article will introduce some settings of this site. Here, through the acl of path_beg, the sent request will be directed to other services instead of the backend specified by the domain name. .

Synology,cli

Change the password of my Synology NAS via the command line

Adjust password by command line synouser --setpw admin <yourpassword>