diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/AbpThemingOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/AbpThemingOptions.cs
index 1197ad6e53..bf999be982 100644
--- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/AbpThemingOptions.cs
+++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/Theming/AbpThemingOptions.cs
@@ -6,6 +6,12 @@ public class AbpThemingOptions
public string? DefaultThemeName { get; set; }
+ ///
+ /// If set, the base element will be added to the head element of the page.
+ /// eg:
+ ///
+ public string? BaseUrl { get; set; }
+
public AbpThemingOptions()
{
Themes = new ThemeDictionary();
diff --git a/framework/src/Volo.Abp.Swashbuckle/wwwroot/swagger/ui/abp.js b/framework/src/Volo.Abp.Swashbuckle/wwwroot/swagger/ui/abp.js
index 0e13317cbf..11cbe56803 100644
--- a/framework/src/Volo.Abp.Swashbuckle/wwwroot/swagger/ui/abp.js
+++ b/framework/src/Volo.Abp.Swashbuckle/wwwroot/swagger/ui/abp.js
@@ -4,7 +4,9 @@ var abp = abp || {};
/* Application paths *****************************************/
//Current application root path (including virtual directory if exists).
- abp.appPath = abp.appPath || '/';
+ var baseElement = document.querySelector('base');
+ var baseHref = baseElement ? baseElement.getAttribute('href') : null;
+ abp.appPath = baseHref || abp.appPath || '/';
/* UTILS ***************************************************/
diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml b/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
index 9a62892b5e..564bf1acd2 100644
--- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
+++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Account.cshtml
@@ -18,6 +18,7 @@
@inject ICurrentTenant CurrentTenant
@inject IStringLocalizer MultiTenancyStringLocalizer
@inject ITenantResolveResultAccessor TenantResolveResultAccessor
+@inject IOptions ThemingOptions
@{
Layout = null;
@@ -34,6 +35,10 @@
+ @if (!ThemingOptions.Value.BaseUrl.IsNullOrWhiteSpace())
+ {
+
+ }
@(ViewBag.Title == null ? BrandingProvider.AppName : ViewBag.Title)
diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml b/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml
index c694c68424..c56c563017 100644
--- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml
+++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Application.cshtml
@@ -1,4 +1,6 @@
-@using Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook
+@using Microsoft.Extensions.Options
+@using Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
+@using Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.ContentTitle
@@ -12,6 +14,8 @@
@using Volo.Abp.Ui.LayoutHooks
@inject IBrandingProvider BrandingProvider
@inject IPageLayout PageLayout
+@inject IOptions ThemingOptions
+
@{
Layout = null;
var containerClass = ViewBag.FluidLayout == true ? "container-fluid" : "container"; //TODO: Better and type-safe options
@@ -40,6 +44,10 @@
+ @if (!ThemingOptions.Value.BaseUrl.IsNullOrWhiteSpace())
+ {
+
+ }
@pageTitle
diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml b/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml
index aaef7898c3..d88d1b7144 100644
--- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml
+++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Layouts/Empty.cshtml
@@ -1,4 +1,6 @@
-@using Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook
+@using Microsoft.Extensions.Options
+@using Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
+@using Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling
@using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.PageAlerts
@@ -10,6 +12,8 @@
@using Volo.Abp.Ui.LayoutHooks
@inject IBrandingProvider BrandingProvider
@inject IPageLayout PageLayout
+@inject IOptions ThemingOptions
+
@{
Layout = null;
var containerClass = ViewBag.FluidLayout == true ? "container-fluid" : "container"; //TODO: Better and type-safe options
@@ -38,6 +42,10 @@
+ @if (!ThemingOptions.Value.BaseUrl.IsNullOrWhiteSpace())
+ {
+
+ }
@pageTitle
@if (ViewBag.Description != null)
diff --git a/npm/packs/core/src/abp.js b/npm/packs/core/src/abp.js
index 8d11ad1fec..3b0fe25095 100644
--- a/npm/packs/core/src/abp.js
+++ b/npm/packs/core/src/abp.js
@@ -4,7 +4,9 @@ var abp = abp || {};
/* Application paths *****************************************/
//Current application root path (including virtual directory if exists).
- abp.appPath = abp.appPath || '/';
+ var baseElement = document.querySelector('base');
+ var baseHref = baseElement ? baseElement.getAttribute('href') : null;
+ abp.appPath = baseHref || abp.appPath || '/';
abp.pageLoadTime = new Date();