Support the ongoing development of Laravel.io →
posted 10 years ago
Configuration

Hello, I am new to this vagrant idea and I have a question (I hope it makes sense here).

Imagine I have a laravel app so I can go to: http://homestead.app:8000. So far so good.

Then imagine I want to use Angular with, well, yeoman maybe. Yeoman is a different app running on let's say port 4000. With yeoman I could proxy all my request to 8000.

If I run all of this in my machine, I can just serve laravel and also launch yeoman app. I can then go to localhost:4000 to see my angular app running.

So with homestead, I can go to port 8000 to see my API but where I want to go, is to port 4000 where my angular app lives.

So, is there anything I can do to run also that yeoman app and also be able to access it via http://homestead.app:4000 ? Maybe doing some extra configuration and running it via the ssh.

Thank you.

Last updated 3 years ago.
0

I made some good steps.

I can make a port forwarding on homestead.rb like:

config.vm.network "forwarded_port", guest: 4000, host: 4000

So I can run my angular app and I can access it via homestead.app:4000 or even localhost:4000. So far, so good.

To make angular proxy the requests to the laravel app, I proxy them to the port 80 and it works, but when I add another app, the angular app will then proxy to that new app.

Even when I can do

homestead.app:8000

or

app2.app:8000

And get different apps, seems like in the VM they both run on the port 80 so I can't tell my angular app what app to use as a proxy API.

Ideas?

Last updated 3 years ago.
0

I got the answer thanks to @trq at laravel irc channel.

I can use the hostname (homestead.app) and also the port so I get redirected to the app I need.

Fantastic.

Last updated 3 years ago.
0

Hi @Foxandxss,

Can you provide example for your (Homestead.yaml).. Thx.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Foxandxss foxandxss Joined 23 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.