Browse Source

Fixes for hosting in subfolder.

pull/741/head
Sebastian 5 years ago
parent
commit
608249f4e8
  1. 4
      backend/i18n/source/backend_en.json
  2. 4
      backend/src/Squidex.Shared/Texts.nl.resx
  3. 4
      backend/src/Squidex.Shared/Texts.resx
  4. 4
      backend/src/Squidex.Web/Pipeline/SetupMiddleware.cs
  5. 19
      backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupController.cs

4
backend/i18n/source/backend_en.json

@ -291,8 +291,8 @@
"setup.ruleHttps.failure": " You are not accessing the site over https. If this warning is not correct then Squidex cannot detect https mode, because your instance is behind a reverse proxy such as nginx. Ensure that http headers are forwarded properly, via the <code>X-Forwarded-*</code> headers.", "setup.ruleHttps.failure": " You are not accessing the site over https. If this warning is not correct then Squidex cannot detect https mode, because your instance is behind a reverse proxy such as nginx. Ensure that http headers are forwarded properly, via the <code>X-Forwarded-*</code> headers.",
"setup.ruleHttps.success": "Congratulations, you are accessing your Squidex installation over a secure connection (https).", "setup.ruleHttps.success": "Congratulations, you are accessing your Squidex installation over a secure connection (https).",
"setup.rules.headline": "System Checklist", "setup.rules.headline": "System Checklist",
"setup.ruleUrl.failure": "You should access Squidex only over one one canonical URL and configure this URL over the <code>URLS__BASEURL</code> environment variable. The current base URL <code>{actual}</code> does not match to the base url <code>{configured}</code>.", "setup.ruleUrl.failure": "You should access Squidex only over one canonical URL and configure this URL with the <code>URLS__BASEURL</code> environment variable. The current base URL <code>{actual}</code> does not match to the base url <code>{configured}</code>.",
"setup.ruleUrl.success": "Congratulations the <code>URLS__BASEURL</code> environment variable is configured properly.", "setup.ruleUrl.success": "Congratulations, the <code>URLS__BASEURL</code> environment variable is configured properly.",
"setup.title": "Installation", "setup.title": "Installation",
"users.accessDenied.text": "This operation is not allowed, your account might be locked.", "users.accessDenied.text": "This operation is not allowed, your account might be locked.",
"users.accessDenied.title": "Access denied", "users.accessDenied.title": "Access denied",

4
backend/src/Squidex.Shared/Texts.nl.resx

@ -959,10 +959,10 @@
<value>System Checklist</value> <value>System Checklist</value>
</data> </data>
<data name="setup.ruleUrl.failure" xml:space="preserve"> <data name="setup.ruleUrl.failure" xml:space="preserve">
<value>You should access Squidex only over one one canonical URL and configure this URL over the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable. The current base URL &lt;code&gt;{actual}&lt;/code&gt; does not match to the base url &lt;code&gt;{configured}&lt;/code&gt;.</value> <value>You should access Squidex only over one canonical URL and configure this URL with the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable. The current base URL &lt;code&gt;{actual}&lt;/code&gt; does not match to the base url &lt;code&gt;{configured}&lt;/code&gt;.</value>
</data> </data>
<data name="setup.ruleUrl.success" xml:space="preserve"> <data name="setup.ruleUrl.success" xml:space="preserve">
<value>Congratulations the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable is configured properly.</value> <value>Congratulations, the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable is configured properly.</value>
</data> </data>
<data name="setup.title" xml:space="preserve"> <data name="setup.title" xml:space="preserve">
<value>Installation</value> <value>Installation</value>

4
backend/src/Squidex.Shared/Texts.resx

@ -959,10 +959,10 @@
<value>System Checklist</value> <value>System Checklist</value>
</data> </data>
<data name="setup.ruleUrl.failure" xml:space="preserve"> <data name="setup.ruleUrl.failure" xml:space="preserve">
<value>You should access Squidex only over one one canonical URL and configure this URL over the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable. The current base URL &lt;code&gt;{actual}&lt;/code&gt; does not match to the base url &lt;code&gt;{configured}&lt;/code&gt;.</value> <value>You should access Squidex only over one canonical URL and configure this URL with the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable. The current base URL &lt;code&gt;{actual}&lt;/code&gt; does not match to the base url &lt;code&gt;{configured}&lt;/code&gt;.</value>
</data> </data>
<data name="setup.ruleUrl.success" xml:space="preserve"> <data name="setup.ruleUrl.success" xml:space="preserve">
<value>Congratulations the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable is configured properly.</value> <value>Congratulations, the &lt;code&gt;URLS__BASEURL&lt;/code&gt; environment variable is configured properly.</value>
</data> </data>
<data name="setup.title" xml:space="preserve"> <data name="setup.title" xml:space="preserve">
<value>Installation</value> <value>Installation</value>

4
backend/src/Squidex.Web/Pipeline/SetupMiddleware.cs

@ -25,7 +25,9 @@ namespace Squidex.Web.Pipeline
{ {
if (!isUserFound && await userService.IsEmptyAsync()) if (!isUserFound && await userService.IsEmptyAsync())
{ {
context.Response.Redirect("/identity-server/setup"); var url = context.Request.PathBase.Add("/identity-server/setup");
context.Response.Redirect(url);
} }
else else
{ {

19
backend/src/Squidex/Areas/IdentityServer/Controllers/Setup/SetupController.cs

@ -20,6 +20,7 @@ using Squidex.Infrastructure;
using Squidex.Infrastructure.Reflection; using Squidex.Infrastructure.Reflection;
using Squidex.Infrastructure.Translations; using Squidex.Infrastructure.Translations;
using Squidex.Infrastructure.Validation; using Squidex.Infrastructure.Validation;
using Squidex.Web;
namespace Squidex.Areas.IdentityServer.Controllers.Setup namespace Squidex.Areas.IdentityServer.Controllers.Setup
{ {
@ -99,12 +100,10 @@ namespace Squidex.Areas.IdentityServer.Controllers.Setup
{ {
var externalProviders = await SignInManager.GetExternalProvidersAsync(); var externalProviders = await SignInManager.GetExternalProvidersAsync();
var request = HttpContext.Request;
var result = new SetupVM var result = new SetupVM
{ {
BaseUrlConfigured = urlGenerator.BuildUrl(string.Empty, false), BaseUrlConfigured = urlGenerator.BuildUrl(string.Empty, false),
BaseUrlCurrent = $"{request.Scheme}://{request.Host}", BaseUrlCurrent = GetCurrentUrl(),
ErrorMessage = errorMessage, ErrorMessage = errorMessage,
EverybodyCanCreateApps = !uiOptions.OnlyAdminsCanCreateApps, EverybodyCanCreateApps = !uiOptions.OnlyAdminsCanCreateApps,
IsValidHttps = HttpContext.Request.IsHttps, IsValidHttps = HttpContext.Request.IsHttps,
@ -121,5 +120,19 @@ namespace Squidex.Areas.IdentityServer.Controllers.Setup
return result; return result;
} }
private string GetCurrentUrl()
{
var request = HttpContext.Request;
var url = $"{request.Scheme}://{request.Host}{request.PathBase}";
if (url.EndsWith(Constants.PrefixIdentityServer, StringComparison.Ordinal))
{
url = url[0..^Constants.PrefixIdentityServer.Length];
}
return url.TrimEnd('/');
}
} }
} }

Loading…
Cancel
Save