Skip to content

Instantly share code, notes, and snippets.

@hotmeteor
Created May 6, 2014 23:38
Show Gist options
  • Save hotmeteor/e09c8ddfa64621daedbc to your computer and use it in GitHub Desktop.
Save hotmeteor/e09c8ddfa64621daedbc to your computer and use it in GitHub Desktop.
Make AJAX calls to MAMP on the same domain as your grunt server
ProxyPass /ajax/ http://localhost:80/myappfolder/app/
ProxyPassReverse /ajax/ http://localhost:80/myappfolder/app/
ProxyPass / http://localhost:9000/
ProxyPassReverse / http://localhost:9000/
@hotmeteor
Copy link
Author

This is an advanced setup from https://gist.github.com/hotmeteor/11407089
It allows you to make AJAX requests to PHP scripts on the same domain as your grunt server.

  1. Start MAMP
  2. Start grunt server
  3. Define a pathname you'll make requests to, ie. ajax. This path doesn't really exist, it's just the proxy we're using to pass requests through
  4. Make sure the proxy is pointing to the root folder where your app is. You can then use a normal structure in your AJAX requests, ie. /ajax/app.php or /ajax/api/method/
  5. Have fun!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment