Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

REST api together with MVC web app - how to consume by other app


My problem is as follows: I have a regular web application, single module, with simple ACL and so on. The other is also a web application, but with some API-like behaviors in that it (should) provides some data in form of JSON to remote applications. I am testing everything on localhost. I have virtual hosts, one is and the other is for example.

Right now there is a controller ApiController with a simple json returning method. Works perfectly in the subdomain. However, as soon as i try the same thing in a browser window where the other app is running (webapp1), the same request returns nothing except the frontpage HTML of webapp2. I have debug points all over the application, but none of them are getting hit, when i fire the request in another subdomain.

Now i did have problems with Cross-origin resource sharing before, but it doesn't show it to be an issue anymore (or maybe it is?). Basically it no longer shows troubles with headers. However i did notice that there is no xdebug cookie when im in webapp1 domain so no wonder it is not debugging. 'm using a Firefox addon for debugging and it is on on both browser tabs, but it will not fire in a different domain.

For the sake of testing i turned off ACL in both apps so at least that should'nt interfere.
If any of you have experience with this, please help. I'm kind of lost and


Update: the question was dumb. I found the issue. It was nothing to do with subdomains, but rather the fact i did not take into account that the BaseController class actually forwarded (when not logged in) always to front page. Will make a different base controller for api controllers.