We have a multi-site environment.
In one of the module, we are calling the same controller/action
from all the sites. Perhaps, the same Javascript file which calls this controller/action
is included in all the sites. But, I'm able to get the response from Site1
but, Site2
is redirecting the request to 404
.
http://site1/api/mic/MyController/myaction -- Is working
http://site2/api/mic/MyController/myaction -- Is not working
Recently we have upgraded from Sitecore 8.0.4 to Sitecore 9.0.2
, In Sitecore 8 instance both are working
.
Just to debug the issue,
- I had deleted the
Site.Config for
Site2` and tested, it is able to get the proper response. Not sure what's happening here. Attached the site config below. - Also noticed that from
site2
I'm not able to hit any of the controller/action.
I suspect that, Api routing is not working. When we include Site2's site.config, Sitecore routing is taking place, not the mvc routing.
Your help and prompt response are appreciated.
UPDATE 1 : I had noticed that, in Site definition, when the start item is pointing to Site2's home item, i'm getting error. It works with any other item in the content tree. Is there any problem with Sitecore item? or did i missed any configuration?
UPDATE 2 :
I noticed that, under Site2 Sitecore node, we have wild card items. Something like this
StartItem/*/*
This is matching http://site2/api/mic/MyController/myaction
request.
Now I'm sure that, when we call the api it is matching the Sitecore Content tree items and then it is redirecting to 404 page.
Now the question is how to tell Sitecore to take mvc routing as routing for this request?