Running my Aurelia app under Asp MVC Core 1.0 presents a challenge when deploying to IIS. The app uses HttpClient to interact with controller actions that return JSON data. All the actions are in the Home controller, and the HttpClient is configured like this:
http.configure(config => {
config
.useStandardConfiguration()
.withBaseUrl('Home/');
});
While everything works fine on localhost:55475 during development in Visual Studio, issues arise when deployed on IIS as a web application under the default website. Since the root URL becomes server.org/MyApp, calling this.http.fetch('GetData')
incorrectly requests from server.org/Home/GetData instead of server.org/MyApp/Home/GetData, leading to a 404 error.
The problem lies in the fetch request ignoring the 'MyApp' portion of the URL. Although I expected the absence of a leading slash in .withBaseUrl
to make the URL relative, it seems that's not the case?