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

tinfoilman's avatar

External redis host on Forge

I'm pretty new to Forge, and I've done some searches on Google and Laracasts but can't seem to find anyone with this same scenario.

I have an existing large application running on Laravel Vapor that has a substantial Redis cache setup with it. I want this little Forge site to access the same Redis cache. I should be able to connect because I put the Forge server on the same VPC as Redis, and configured the security group for access. Basically, it's the same way Vapor connects to it, and it will be darn fast.

The problem is I can't figure out how to get Forge to point the a redis host! I'm able to use redis commands right from the get-go, which is pretty awesome, but what the heck is it connecting it? No matter what I put in my Forge environment file, it still runs off the same redis cache. The default Forge environment file says REDIS_HOST=127.0.0.1, and it seems to mean nothing.

The Forge documentation talks about how to connect to the site's cache externally, but not how to connect Forge to an external host.

0 likes
3 replies
bobbybouwmann's avatar

The redis host should be the URL of the redis instance that is configured in AWS. Laravel Vapor configures ElastiCache for you for Redis. So in your AWS account, you should be able to find the URL to this instance. That should be configured as REDIS_HOST

tinfoilman's avatar

Thanks for the reply, but I'm sorry I wasn't clear. My issue isn't with the AWS endpoint.

It appears that Forge doesn't look at REDIS_HOST variable. For instance, i could say REDIS_HOST=WTF or anything else and the site still runs like normal with the same cache values! I know it's looking at the environment file because I have the DB_HOST successfully pointed to my AWS RDS instance.

So apparently Forge has some other internal mechanism of using Redis cache by default, and I can't figure it out.

tinfoilman's avatar
tinfoilman
OP
Best Answer
Level 6

I finally figured out what was going on. My AWS redis host was working the whole time!

I did a php artisan cache:clear on my Forge app and saw that everything on my Vapor app was also cleared. Then I did a Redis::keys('*') on Forge to see how I could clear the ElastiCache cluster, but not read anything. That's when I saw that all of the keys were prefixed with APP_NAME_database. I never realized that laravel adds the prefix in config/database.php behind the scenes to avoid collisions between apps. Well in my case, I wanted the 'collision' geez.

Please or to participate in this conversation.