Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

LaraBABA's avatar

Have you ever seen this kind of error (Laravel 5.8) please? Invalid Host "${ip}:${port}"

Hi all,

I am receiving form time to time this kind of error on the live site, any idea what would this be please?

production.ERROR: Invalid Host "${ip}:${port}". (View: laravel/resources/views/layouts/app.blade.php) {"exception":"[object] (Facade\Ignition\Exceptions\ViewException(code: 0): Invalid Host \"${ip}:${port}\". (View: laravel/resources/views/layouts/app.blade.php) at laravel/vendor/symfony/http-foundation/Request.php:1174)

I am wondering if this could be websocket communication issues

0 likes
12 replies
Nihir's avatar

Hi @user476820 I would like to inform you that you faced an error it has many possibilities according to me.

I faced the same issue in the past. You can follow these steps. It works on my production server.

  1. Check the.env variables and correct them

  2. check your view and controller which data passed. They don't have a different table you mentioned in the .env file.

  3. Check your hosts for the production servers and clear your caches from the site

php artisan optimize:clear
PHP artisan config:cache
PHP artisan optimize
LaraBABA's avatar

@Nihir I thought the optimize commands was removed around Laravel 5.7 / 5.8 ?

I already cleared everything with:

php artisan view:clear
php artisan config:clear
php artisan config:cache
php artisan route:cache
php artisan cache:clear

Regarding Point 2, if one of the env() was incorrect it would have triggered an error. As I said to Snapey I think it is due to this library:

https://beyondco.de/docs/laravel-websockets/getting-started/introduction

Could it be that the websocket server from time to time does not communicate properly? I will check it out further.

Sinnbeck's avatar

Can you find this anywhere in your projects code? ${ip}:${port}

LaraBABA's avatar

@Sinnbeck The only ip/port that is set is for this:

https://beyondco.de/docs/laravel-websockets/getting-started/introduction

I can only imagine being something to do with the websockets. I was worried of a security problem, like someone trying to hit a port that does not exists.

Sinnbeck's avatar

@User476820 ok. It just looks php code, so I assumed it was somewhere to be found in your code. Have you tried searching the whole project for that string?

LaraBABA's avatar

@Sinnbeck Yes this is the first thing I did in phpstorm and did a project "Find in files" and nothing showed up. This is why I am a bit confused to be honest. I see this error at least 3 to 4 times per day in my logs on the production server. I looked everywhere but cannot find any better error output to help me troubleshoot the issue.

I was also thinking about something..... As the websockets in the vue app connect to the PHP websocket PORT(using NON SPA, blade with vue). Could it be that someone who is trying to cache the data for the first time may not be able to connect to the socket funky notifications but may connect on the second page load....

Sinnbeck's avatar

@User476820 I dont assume it is on github, so others can have a look and see if they can find it? Did you search the whole project, and not just the app folder (make sure to search vendor folder as well)

If you have ${ip}:${port} in your view file perhaps and that is passed to vue, then that could trigger the error.

davodavo's avatar

Just a fyi, we see these all the time in production. typically this is due to a malicious request being sent to your server by a third party. Symfony is catching and throwing an exception appropriately to prevent the request making it any further into your stack.

1 like
LaraBABA's avatar

@davodavo Thank you so much! I could not find a way to solve it. How did you manage to work out that it was a malicious request?

ChristArt's avatar

I also get these entries in my log file daily. I wish they could be captured and dealt with instead of littering my log files. I do love empty log files.

rubens2009's avatar

In my case, I found that I had been wrong the "app_url" in the .env file.

CENTRAL_DOMAIN_URL=domain.local # domain without protocol and without trailing slash. eg: domain.local
APP_URL=http://"${CENTRAL_DOMAIN_URL}"

Instead:

APP_URL="http://${CENTRAL_DOMAIN_URL}"

Please or to participate in this conversation.