I am currently working on an angular application that is hosted on a test server running IIS with a .net core backend. The application is set up on a virtual directory, for example www.myTestApp/crm (the actual domain name being fictional). During the build process, I use the command ng build --base-href "/CRM" --deploy-url "/CRM/" --prod.
However, I have noticed that my Http Requests from the angular app are sending requests from www.mytestapp.com/ instead of www.mytestapp.com/crm. I am curious to understand how Angular determines the base URL in this scenario even though I have clearly specified /crm during the build.
An example of one of my http requests can be seen below:
return this.http
.get("/api/users/IsOutboundAgent")
.pipe(map((data: any) => {
this.isOutboundAgent = data;
return this.isOutboundAgent;
}));
One possible solution would involve setting a global variable before each http request based on environment variables or using an http intercept. Nevertheless, I am intrigued by why the "crm" part is excluded. Could it be that Angular defaults to using just the domain name when no path is specified?