Hi Team,
We host an ABP 10.6 (Modern Apps) host app behind a reverse proxy under a path base (e.g. https://example.com/test/svc, using UsePathBase). Volo.Abp.AdminConsole works at /admin-console without a path base, but under a path base the SPA's router has basepath hard-coded to '/admin-console' (main-*.js), and the HTML contains root-relative asset URLs (/admin-console/assets/..., /theme-override.css). We worked around the middleware order and the HTML URLs, but the SPA router still shows "Page not found" and redirects outside the path base. Is there an official, supported way to run Admin Console under a path base (a configuration option, a build-time base setting, or a recommended hosting model)? If not, what is the recommended approach for hosting several environments on one origin?
Thanks, Juari
3 Answer(s)
-
0
Additional information:
Observed behaviour at https://example.com/dev/svc/admin-console: the page loads (assets are served after we fixed middleware order and rewrote root-relative HTML URLs), but the SPA redirects the browser to https://example.com/admin-console/dev/svc/admin-console and shows "404 Page not found". The sidebar Home link points to https://example.com/admin-console/. This matches the router basepath being hard-coded to '/admin-console' in main-*.js. Our OpenIddict client redirect URIs (seeded from AdminConsole RootUrl) are https://example.com/dev/svc/admin-console/ and .../silent-renew.html.
Thanks, Juari
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
This is fixed in 10.6.1. In 10.6.0 the Admin Console shell and the SPA router base path are built with a fixed
/admin-console, so it can't work under a path base. From 10.6.1, the middleware addsRequest.PathBaseto the shell URLs, and the SPA reads its router base path and API base at runtime.It's the same issue as https://abp.io/support/questions/10823/, you can check it for reference.
Please upgrade the
Volo.Abp.*packages to 10.6.1 (or 10.7) and keepUsePathBasebeforeInitializeApplicationAsyncinProgram.cs:var app = builder.Build(); app.UsePathBase("/dev/svc"); await app.InitializeApplicationAsync();After the upgrade you can remove your HTML URL rewrite. The shell already comes with the path base, so you don't need it anymore. No extra Admin Console setting is needed, and your current
RootUrland redirect URIs with/dev/svcare correct.So hosting several environments on one origin with a path base for each is fine once you're on 10.6.1.
Thanks
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
Thank you, this resolved it. We upgraded all Volo.* packages (including LeptonX) to 10.6.1, moved UsePathBase to Program.cs before InitializeApplicationAsync as you advised, and removed our HTML URL rewrite and the middleware-order workaround.
Admin Console now works under a path base on both our dev and test environments (each environment is served under its own path base on a single origin): the shell loads with the correct base href, the SPA router and API base follow the path base, OIDC sign-in works with our existing RootUrl and redirect URIs, and the account pages (including /gdpr) open as expected. No extra Admin Console setting was needed.
Thanks also for pointing to the related question. Please feel free to close this ticket. If we notice anything else under a path base we will open a new one.
Best regards
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)