MAMP Bad Request 400 after upgrading to 4.2.1

After updating MAMP to the latest version (4.2.1 at the time of writing), when I visit any virtual host URL, I get Bad Request error. I noticed that it is only happening to the domains with my custom development TLD (.2u).

I changed Apache Log level to debug, and got the following lines:
[Wed Dec 13 10:15:48 2017] [debug] vhost.c(791): [client] [strict] Invalid host name 'dash.2u', problem near: .2u
[Wed Dec 13 10:15:48 2017] [debug] vhost.c(886): [client] Client sent malformed Host header: dash.2u
[Wed Dec 13 10:15:48 2017] [debug] protocol.c(1369): [client] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /

Searching the web, found it is related to HttpProtocolOptions directive. Apache will be strict checking request headers, for my case, the TLD was invalid.

I tried to add HttpProtocolOptions Unsafe, but it didn’t help, probably because of  this bug affecting the Apache/2.2.32 that MAMP provides.

The last solution was to change my development TLD to .dv and now everything is working fine.

MailCatcher error env: catchmail: No such file or directory

I setup MailCatcher for a local PHP mails delivery but messages won’t get delivered. After googling, I found an error in Apache log:

env: catchmail: No such file or directory

Now, I figured out that I need to enter the full path to catchmail executable. I executed this command:

which catchmail

the output was: /usr/local/bin/catchmail

Then updated the php.ini sendmail_path entry to:

sendmail_path = /usr/bin/env /usr/local/bin/catchmail -f

And restarted Apache, and emails started showing up in the MailCatcher window 🙂