Reputation: 899
I have an Angular application I've deployed to an IIS web application at my-machine:8111/my-app
. I've set both the base tag and the APP_BASE_HREF value mentioned in this answer to the absolute URL for the app: https://my-machine:8111/my-app/
.
For some reason, when I initially load the application—when I hit that absolute URL—I get an error:
Error: Cannot match any routes. URL Segment: 'my-app'
I don't know why the web application name is being read as part of the Angular route. I'm sure the base URL is correct: If I take of the last slash or try a relative path I can't even load the application.
Why isn't it routing to /
? How can I fix it?
Upvotes: 2
Views: 2150
Reputation: 9260
APP_BASE_HREF
is used in the following manner: {{host}}:{{port}}{{APP_BASE_HREF}}
, and with your APP_BASE_HREF
set to the full string "https://my-machine:8111/my-app/"
it's expecting that to be appended into the {{APP...}} section. It only wants the part after {{host}}:{{port}}
since those two items are handled by your server already.
Setting APP_BASE_HREF
to "/my-app"
will solve the current problem, but your IIS server may require addition tuning such as route-parameter forwarding before your app is 100% functional.
Upvotes: 3