mailinabox
mailinabox copied to clipboard
Allow configuration of web redirects
I have some domains that should redirect to others. Is this already possible, or would this be a feature request?
There is an undocumented, unsupported feature:
https://github.com/mail-in-a-box/mailinabox/blob/master/management/web_update.py#L138
I would like to include this within the control panel some day.
FTR this feature can be used by creating a file called /home/user-data/www/custom.yaml
with content like this:
my-domain.com:
redirects:
^/foo: https://example.com/bar
proxies:
/baz: https://example.com/qux
The above example would result in nginx directives like this:
server {
server_name my-domain.com;
# ...
rewrite ^/foo https://example.com/bar permanent;
location /baz {
proxy_pass https://example.com/qux;
}
}
The relevant nginx docs are here:
-
rewrite
: http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite -
proxy_pass
: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
The configuration must be regenerated/reloaded before this takes effect. You can do so by navigating to Web within the admin panel and clicking on any of the Change buttons or simply run sudo ~/mailinabox/tools/web_update
.
Can you also include uWSGI proxies in this file?
hey guys... I'm having trouble with this feature.
# custom.yaml
sub.my-domain.com:
redirects:
^/: http://www.yahoo.com
and running webupdate leaves me with a 301 redirect to the MIB box's root domain
@bjmuld Try something like
sub.my-domain.com:
redirects:
^.*: $scheme://www.yahoo.com$request_uri
I have discovered that setting up a redirect like this blocks the verification step when provisioning a new Let's Encrypt certificate. Temporarily removing the redirect when provisioning the certificates does the trick.
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator webroot, Installer None Performing the following challenges: http-01 challenge for my.other.domain http-01 challenge for my.domain Using the webroot path /home/user-data/ssl/lets_encrypt/webroot for all unmatched domains. Waiting for verification... Cleaning up challenges Failed authorization procedure. my.domain (http-01): urn:ietf:params:acme:error:unknownHost :: The server could not resolve a domain name :: No valid IP addresses found for my.domain IMPORTANT NOTES: - The following errors were reported by the server: Domain: my.domain Type: unknownHost Detail: No valid IP addresses found for my.domain To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address.
@bjmuld Try something like
sub.my-domain.com: redirects: ^.*: $scheme://www.yahoo.com$request_uri
I know this is an old issue, but I wanted to say. I got this to work pretty easily using the above.
custom.yaml
oddly, it's still not doing anything for me....
I have a custom dns entry: CNAME record pointing mail.mydomain.net to the mailinabox host
I have a custom.yaml
in /home/usr-data/www/
with the contents:
mail.mydomain.net:
redirects:
^.*: https://www.yahoo.com
and ran web_update
and restarted nginx service.... the result is nginx serving the default site at mail.mydomain.net
weird. I added the subdomain to mailinabox just like normal. got it to display the default website.
Then added custom.yaml under www directory. Updated the web service, and it forwarded no problem.
The original post was from two years ago, but i never knew i could do this.. been running mailinabox for my dns for years now.
sub.domain.com: redirects: ^/*: $scheme://newdomain.com
This worked for me no problem, but i had to create the subdomain in mailinabox first.
yeah, tried those contents exactly... grepping /etc/nginx doesn't return any results for sub.domain.com or my new subdomain or yahoo or newdomain. doesn't look like web_update is actually regenerating anything
you don't have to do anything in /etc/nginx..
just have mailinabox serve a valid page at your subdomain with a TLS cert. shows the default webpage.
Then go into your ..../www/ directory and create custom.yaml file with
sub.domain.com: redirects: ^/*: $scheme://newdomain.com/PAGE1/PAGE2
just put in your link.
and then
$sudo ~/mailinabox/tools/web_update
it takes a while little bit. and I restarted my server, then it just worked.
Can't seem to get this working at all.
I've tried multiple variations but everything I do just redirects me to box.mydomain.co.uk.
I've created a placeholder file at /home/user-data/www/default/sub/index.html
I've created /home/user-data/www/custom.yaml and added:
#custom.yaml
sub.mydomain.co.uk:
redirects:
^/*: $scheme://192.168.x.x/
Then run sudo ~/mailinabox/tools/web_update
I think I've also pretty much tried every variation of text listed above, but nothing changes. Stumped.
anyone got this working?
i followed the instructions but nothing working.
I want to map my other email domains to the customdomain/mail directory
I could not.
On 12/9/20 2:02 AM, Dave wrote:
anyone got this working?
my web_update returns 500 error
|
500 Internal Server Error Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mail-in-a-box/mailinabox/issues/608#issuecomment-741603860, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWULT32HI6AVTOIKGJFVCDST4VIHANCNFSM4BVKBNZQ.
-- Barry Muldrey [email protected] mailto:[email protected]
I can do it.
Scott
On Dec 9, 2020, at 6:48 AM, Barry Muldrey [email protected] wrote:
I could not.
On 12/9/20 2:02 AM, Dave wrote:
anyone got this working?
my web_update returns 500 error
|
500 Internal Server Error Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mail-in-a-box/mailinabox/issues/608#issuecomment-741603860, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWULT32HI6AVTOIKGJFVCDST4VIHANCNFSM4BVKBNZQ.
-- Barry Muldrey [email protected] mailto:[email protected] — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Can you describe your setup? In my case, I'm making a new CNAME entry in
the DNS (admin panel) called test.mydomain.net
and pointing it to the
mailinabox server. Then I make /home/user-data/www/custom.yaml
look like:
test.mydomain.net:
redirects:
^/: https://www.google.com
then, I run sudo ~/mailinabox/tools/web_update
when I point a browser to https://test.mydomain.net
, I get the
mailinabox default page from /home/user-data/www/default
Can you describe your setup? Is it apparent what you're doing differently?
Thanks!
On 12/9/20 6:57 AM, Upkiik wrote:
I can do it.
Scott
On Dec 9, 2020, at 6:48 AM, Barry Muldrey [email protected] wrote:
I could not.
On 12/9/20 2:02 AM, Dave wrote:
anyone got this working?
my web_update returns 500 error
|
500 Internal Server Error Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub
https://github.com/mail-in-a-box/mailinabox/issues/608#issuecomment-741603860,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACWULT32HI6AVTOIKGJFVCDST4VIHANCNFSM4BVKBNZQ.
-- Barry Muldrey [email protected] mailto:[email protected] — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mail-in-a-box/mailinabox/issues/608#issuecomment-741753402, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWULT4I5HH4OHAQLEISXATST5X3XANCNFSM4BVKBNZQ.
-- Barry Muldrey [email protected] mailto:[email protected]
change a https to schema
Scott
On Dec 9, 2020, at 7:11 AM, Barry Muldrey [email protected] wrote:
Can you describe your setup? In my case, I'm making a new CNAME entry in the DNS (admin panel) called
test.mydomain.net
and pointing it to the mailinabox server. Then I make/home/user-data/www/custom.yaml
look like:test.mydomain.net: redirects: ^/: https://www.google.com
then, I run
sudo ~/mailinabox/tools/web_update
when I point a browser to
https://test.mydomain.net
, I get the mailinabox default page from/home/user-data/www/default
Can you describe your setup? Is it apparent what you're doing differently?
Thanks!
On 12/9/20 6:57 AM, Upkiik wrote:
I can do it.
Scott
On Dec 9, 2020, at 6:48 AM, Barry Muldrey [email protected] wrote:
I could not.
On 12/9/20 2:02 AM, Dave wrote:
anyone got this working?
my web_update returns 500 error
|
500 Internal Server Error Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub
https://github.com/mail-in-a-box/mailinabox/issues/608#issuecomment-741603860,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACWULT32HI6AVTOIKGJFVCDST4VIHANCNFSM4BVKBNZQ.
-- Barry Muldrey [email protected] mailto:[email protected] — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mail-in-a-box/mailinabox/issues/608#issuecomment-741753402, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWULT4I5HH4OHAQLEISXATST5X3XANCNFSM4BVKBNZQ.
-- Barry Muldrey [email protected] mailto:[email protected] — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
you create a new user noreply at subdomain. domain.com and then update the Yaml file. you don’t create a cname in mailinabox. all the dns is done automatically by creating the user with subdomain.
schema instead of https in the url redirect amd reload shoukd work
Scott
On Dec 9, 2020, at 7:11 AM, Barry Muldrey [email protected] wrote:
Can you describe your setup? In my case, I'm making a new CNAME entry in the DNS (admin panel) called
test.mydomain.net
and pointing it to the mailinabox server. Then I make/home/user-data/www/custom.yaml
look like:test.mydomain.net: redirects: ^/: https://www.google.com
then, I run
sudo ~/mailinabox/tools/web_update
when I point a browser to
https://test.mydomain.net
, I get the mailinabox default page from/home/user-data/www/default
Can you describe your setup? Is it apparent what you're doing differently?
Thanks!
On 12/9/20 6:57 AM, Upkiik wrote:
I can do it.
Scott
On Dec 9, 2020, at 6:48 AM, Barry Muldrey [email protected] wrote:
I could not.
On 12/9/20 2:02 AM, Dave wrote:
anyone got this working?
my web_update returns 500 error
|
500 Internal Server Error Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
|— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub
https://github.com/mail-in-a-box/mailinabox/issues/608#issuecomment-741603860,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACWULT32HI6AVTOIKGJFVCDST4VIHANCNFSM4BVKBNZQ.
-- Barry Muldrey [email protected] mailto:[email protected] — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mail-in-a-box/mailinabox/issues/608#issuecomment-741753402, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWULT4I5HH4OHAQLEISXATST5X3XANCNFSM4BVKBNZQ.
-- Barry Muldrey [email protected] mailto:[email protected] — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
So I was just playing around with this again, and now ~/mailinabox/tools/webupdate
returns an error even if config.yaml
is empty:
user@box:/home/user-data/www$ ~/mailinabox/tools/web_update
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
A little more info: There is a message on the system status page:
But mailinabox is still serving the default page at
www.mydomain.net
...
@upkiik: Do you have any custom DNS entries on the same domain you're using for your redirects?
Just to chime in here, for me this works fine as well. I want to redirect mail.mydomain.com
to roundcube and box.mydomain.com
to nextcloud. This is my custom.yaml
in /home/user-data/www
:
mail.mydomain.com:
redirects:
^/$: https://mail.mydomain.com/mail
box.mydomain.com:
redirects:
^/$: https://box.mydomain.com/cloud
After creating the file, I ran sudo ~/mailinabox/tools/web_update
.
@bjmuld I have a custom DNS record, but just for TLS-RPT.
I also initially wasn't sure if I had to create the directories for the subdomains, so I created one for mail
sub, but not for box
, and both work fine (so creating the subdirectory is not necessary).
Fixed it. Of course it was a problem on my end. I had custom DNS entries that were clobbering the internal server. Removed them, created email domain aliases, and voila!
Same problem as @bjmuld and same solution. Custom DNS record was the cause of the problem. After deleting email aliases and the DNS record, I created the alias afresh and the problem was solved.
it is also possible to change the configuration entry : client_max_body_size 0;
via the custom_yaml for a proxy ?
it is also possible to change the configuration entry : client_max_body_size 0;
via the custom_yaml for a proxy ?
I've added client_max_body_size 2G;
to my example.com.conf
custom file to allow for larger uploads. I assume you could set it to 0 to disable the size checking (based the nginx documentation website).