I have encountered an issue with my AngularJS application and Asp.net Web Api. Both applications are hosted on port 80 of the IIS server. The problem arises when the web api URL cannot be accessed due to angularjs routing redirecting API calls to the root of the application.
AngularJS Routing
.when('/home', {
templateUrl: baseUrl + 'home.html',
controller: 'homeCtrl'
})
.otherwise({
redirectTo: '/' //This redirection causes the web api call to redirect to the root of the web app
});
Is it possible to configure the angular routing method in a way that allows Web Api requests to run as expected?
EDITED
I have implemented some rewrite rules in my wb.conf file:
<rule name="RemoveTrailingSlash" stopProcessing="true">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}" />
</rule>
(More rewrite rules go here...)