drewzboto / grunt-connect-proxy

Grunt Connect support for proxying API calls during development
MIT License
424 stars 122 forks source link

Config not working. #57

Closed JohnBueno closed 10 years ago

JohnBueno commented 10 years ago

I am having quite a bit of trouble getting grunt-connect-proxy working properly. Based on my current grunt file I see through terminal that the proxy has been set up with the message:

Running "configureProxies:server" (configureProxies) task Proxy created for: /api to localhost:8000

However, all requests to /api are still routing through localhost:9000 which is the express server the angular app is running on rather than port 8000 which they proxy was created for. Here is a link to my gruntfile:

https://gist.github.com/JohnBueno/7d48027f739cc91e0b79

Would it be possible to update examples/sample.yeoman.grunt.js to match the new config documented in the readme?

Any help on this would be much appreciated!

guifromrio commented 10 years ago

Hey, @JohnBueno.

Shameless plug: try using connect-tryfiles.

I have not used this plugin in a while, and maybe tryfiles can be simpler.

JohnBueno commented 10 years ago

The issue it turns out was not with grunt-connect-proxy. The problem had to do with where I was spinning up my local apache server. When trying to run laravel on localhost:8000 or 127.0.0.1:8000 I would get an error back when trying to contact if from angular saying:

An error has occurred: {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"}

When changing the address of my apache server to http://0.0.0.0:8000/ using:

php artisan serve --host 0.0.0.0

I was then able to connect to Laravel using grunt connect proxy with with the config from the documentation.