MailHog not working with Safari

Hey guys, thank you in advance for any help.

I’m having an issue with MailHog and Safari on development.

When I have SSL enabled on my development environment and try to access the site http://example.test:8025/ it displays this error:

Safari Can't Open The Page
Safari can't open the page "https://example.test:8025/" because Safari can't establish a secure connection to the server "example.test".

Seems that Safari forces to use SSL also with MailHog (but I’m using HTTP).

Works well with Chrome and Firefox instead.

Can someone help me trying to solve this issue?

Thank you.

See https://roots.io/trellis/docs/mail/#mailhog-and-ssl-with-hsts

Sorry @ben, my bad, I didn’t see this section in the docs. But why this happens only with Safari and not also with other browsers?

If it’s only occurring in Safari and the cause is HSTS, then the following workflow is the likely culprit:

  • You are developing in Safari (so Safari has “learned” through HSTS that it should only connect to your site through https).
  • When you try to access Mailhog at http, Safari complains, because HSTS says it can’t use http for that site. It doesn’t say this, but the upshot is that MailHog “doesn’t work” in Safari.
  • You try it in Chrome (this is the first time visiting this domain, and you visit it at http, so HSTS doesn’t kick in) and it works.
  • You try it in Firefox (this is the first time visiting this domain, and you visit it at http, so HSTS doesn’t kick in) and it works.

I recommend reading up on what HSTS is and how it works.

Thank you so much @alwaysblank for the explanation.