Production issue: How to access API route when ~/umbraco is filtered by IP Address & Domain Restrictions
Something that has bugged me for a while is that I can't create an Umbraco API Controller that is consumed by say a page in the website since our production environment blocks requests to ~/umbraco.
If I create a controller that's accessible by the following it's always blocked because it starts with ~/umbraco
~/umbraco/api/canyou/dosomething
I have tried to create a custom route in the routing table but this doesn't seem to work.
Production issue: How to access API route when ~/umbraco is filtered by IP Address & Domain Restrictions
Something that has bugged me for a while is that I can't create an Umbraco API Controller that is consumed by say a page in the website since our production environment blocks requests to ~/umbraco.
If I create a controller that's accessible by the following it's always blocked because it starts with ~/umbraco
~/umbraco/api/canyou/dosomething
I have tried to create a custom route in the routing table but this doesn't seem to work.
Can someone tell me if this is possible and how?
Paul,
My suggestion would be using WebApiController instead of UmbracoApiController
That way your URL would be ~/Api/Controller/Action
Would that work for you?
Richard
Hi Richard,
I didn't think I could use the Umbraco backend this way. Turns out I can :-)
And a route in the routing table:
Thanks
Yeah, the UmbracoApiController inherits from ApiController in .NET
Unless you're using some of the extras in that controller like UmbracoHelper for example, then you can use the standard .NET controller.
Even if you needed UmbracoHelper you could just instantiate it in your controller anyway.
Glad that helped.
is working on a reply...