One of the projects I work on uses a combination of Angular and Laravel. Our Angular-based single page application consumes our restful API written in Laravel. We came across a bug that we had to find a solution for.

To help deal with cross-site requests we decided to put the Laravel code base under the alias /api. For example, our website lives at and our API lives at When trying this on our Nginx server we ran into a problem, so I thought I would share the solution.