wileecoyote
wileecoyote

Reputation: 83

Angular: serve all build files from a subdirectory

I'm building an Angular 15 application and I'd like to have all the files served to the end user from a subdirectory rather than from the domain root. For example, what now is GET http://example.com/main.js should be GET http://example.com/app/main.js, while the application index.html would still be served from any location other than http://example.com/app/**.

It looks like the option I was looking for, deployUrl has been deprecated and I can't manage to achieve the desired scheme not even following this detailed answer I found while searching around.

Trying to use both baseHref and APP_BASE_HREF causes the application to be served only from subpaths of baseHref, so, for example, setting "baseHref": "/foo" and the value provided to APP_BASE_HREF to /bar/ leads to

GET http://example.com/ not found
GET http://example.com/bar not found
GET http://example.com/foo remapped on the browser to http://example.com/bar/foo

Do you know if there is a way to achieve what I want using Angular only and not messing around with the webserver configuration?

Upvotes: 1

Views: 192

Answers (0)

Related Questions