I checked my debugger, and it says it's attempting to use the secure URL, but it comes back 404. So the call is correctly secure. But it seems the controller route just doesn't exist.
I have a testing environment with the exact same build on it, but without a security cert. It works just fine there.
This really makes me think this has something to do with HTTPS, like the routing isn't creating a route for HTTPS, only HTTP. Can this be possible?
This helps you extend a JS helper with the base route of your controller, which then means you can access it from a JS object and then append on the very last segment (the action part) so you don't have to construct it yourself.
One thing to note, is you get that same error for the following reasons:
If there is a redirect going on which changes posts/gets (e.g. enforcing HTTPS or www vs non-www
The action is expecting additional parameters / body content but they aren't provided.
I just don't understand what would be different between my live and test environments. The biggest thing is that live is over HTTPS, while test is just HTTP. Everything works just fine in my test environment.
Backoffice Routing
I am attempting to make a backoffice API. Here is my controller (in the App_Code folder)...
I attempt to call this api via angular like so...
However, in the backoffice, I get the following error:
I think your API URL should be:
/umbraco/backoffice/My/SubscriptionPickerApi/GetAll
See https://our.umbraco.com/documentation/reference/routing/Authorized/
No luck. I have tried all the following paths. None have worked...
backoffice/My/SubscriptionPickerApi/GetAll
/backoffice/My/SubscriptionPickerApi/GetAll
~/backoffice/My/SubscriptionPickerApi/GetAll
umbraco/backoffice/My/SubscriptionPickerApi/GetAll
/umbraco/backoffice/My/SubscriptionPickerApi/GetAll
~/umbraco/backoffice/My/SubscriptionPickerApi/GetAll
Could it have something to do with HTTPS? I notice when I just go to the URL directly, https://domain.com/umbraco/backoffice/My/subscriptionpickerapi/getall, I get...
Could it have something to do with the fact the site is on an SSL, but umbraco is looking for HTTP?
I checked my debugger, and it says it's attempting to use the secure URL, but it comes back 404. So the call is correctly secure. But it seems the controller route just doesn't exist.
I have a testing environment with the exact same build on it, but without a security cert. It works just fine there.
This really makes me think this has something to do with HTTPS, like the routing isn't creating a route for HTTPS, only HTTP. Can this be possible?
Is this for v7? Have you looked at the
umbracoUseSSL
key inweb.config
? You can set it to true or false.<add key="umbracoUseSSL" value="true" />
See https://our.umbraco.com/Documentation/Reference/Security/use-https-v8
You can also set redirects in IIS to always redirect HTTP to HTTPS when using a secure certificate, which should avoid such problems.
Yes, this is v7. 'umbracoUseSSL' is set to 'true' and HTTPS redirects are enabled.
Hey Ross,
It would be worth having a read of this blog post (sorry it's a bit of self promotion)
https://justnik.me/blog/accessing-config-settings-in-your-umbraco-angular-controller
This helps you extend a JS helper with the base route of your controller, which then means you can access it from a JS object and then append on the very last segment (the action part) so you don't have to construct it yourself.
One thing to note, is you get that same error for the following reasons:
Hope that helps,
Nik
I just don't understand what would be different between my live and test environments. The biggest thing is that live is over HTTPS, while test is just HTTP. Everything works just fine in my test environment.
is working on a reply...