Skip to content
Advertisement

Symfony: Format ‘html’ not supported, handler must be implemented

we have a super strange error only on one (mac) machine of our team. It works on others well.

System Setup:

  • OS: Mac OS X Mojave 10.14.6
  • Browser: Iron
  • php 7.4.3

The error when accessing http://127.0.0.1:8000 via the browser or curl http:127.0.0.1:8000 -o output.html is the following (same for both):

3/3) UnsupportedMediaTypeHttpException
Format 'html' not supported, handler must be implemented

in ViewHandler.php line 313
at ViewHandler->handle(object(View))
in ExceptionController.php line 72
at ExceptionController->showAction(object(Request), object(BadRequestHttpException), object(Logger))
in HttpKernel.php line 151
at HttpKernel->handleRaw(object(Request), 2)
in HttpKernel.php line 68
at HttpKernel->handle(object(Request), 2, false)
in ExceptionListener.php line 61
at ExceptionListener->onKernelException(object(ExceptionEvent))
in ExceptionListener.php line 41
at ExceptionListener->onKernelException(object(ExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
in WrappedListener.php line 126
at WrappedListener->__invoke(object(ExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
in EventDispatcher.php line 260
at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.exception', object(ExceptionEvent))
in EventDispatcher.php line 235
at EventDispatcher->callListeners(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.exception', object(ExceptionEvent))
in EventDispatcher.php line 73
at EventDispatcher->dispatch(object(ExceptionEvent), 'kernel.exception')
in TraceableEventDispatcher.php line 168
at TraceableEventDispatcher->dispatch(object(ExceptionEvent), 'kernel.exception')
in HttpKernel.php line 222
at HttpKernel->handleException(object(BadRequestHttpException), object(Request), 1)
in HttpKernel.php line 79
at HttpKernel->handle(object(Request), 1, true)
in Kernel.php line 198
at Kernel->handle(object(Request))
in index.php line 25
(2/3) BadRequestHttpException
Untrusted Host "127.0.0.1".

in HttpKernel.php line 71
at HttpKernel->handle(object(Request), 1, true)
in Kernel.php line 198
at Kernel->handle(object(Request))
in index.php line 25
(1/3) SuspiciousOperationException
Untrusted Host "127.0.0.1".

in Request.php line 1191
at Request->getHost()
in ValidateRequestListener.php line 41
at ValidateRequestListener->onKernelRequest(object(RequestEvent), 'kernel.request', object(TraceableEventDispatcher))
in WrappedListener.php line 126
at WrappedListener->__invoke(object(RequestEvent), 'kernel.request', object(TraceableEventDispatcher))
in EventDispatcher.php line 260
at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(RequestEvent))
in EventDispatcher.php line 235
at EventDispatcher->callListeners(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(RequestEvent))
in EventDispatcher.php line 73
at EventDispatcher->dispatch(object(RequestEvent), 'kernel.request')
in TraceableEventDispatcher.php line 168
at TraceableEventDispatcher->dispatch(object(RequestEvent), 'kernel.request')
in HttpKernel.php line 127
at HttpKernel->handleRaw(object(Request), 1)
in HttpKernel.php line 68
at HttpKernel->handle(object(Request), 1, true)
in Kernel.php line 198
at Kernel->handle(object(Request))
in index.php line 25

Does this (1/3) SuspiciousOperationException, Untrusted Host "127.0.0.1" ring a bell with anybody? There is no specific other software on the system installed, which could cause this interference (at least we think so)

Thx a lot!
Andreas

Advertisement

Answer

So for anybody, who might run into this error in the future:

TRUSTED_HOSTS and TRUSTED_PROXIES in the .env file was not correctly configured.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement