Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Sonarr/commit/de5ce239893e0698e85228cb5648351f18bfbbbd
You should set ROOT_URL correctly, otherwise the web may not work correctly.
3 changed files with
48 additions and
15 deletions
@ -0,0 +1,46 @@
using System ;
using Nancy ;
using Nancy.Bootstrapper ;
using Nancy.Responses ;
using NzbDrone.Common.Extensions ;
using NzbDrone.Core.Configuration ;
namespace NzbDrone.Api.Extensions.Pipelines
{
public class UrlBasePipeline : IRegisterNancyPipeline
{
private readonly string _urlBase ;
public UrlBasePipeline ( IConfigFileProvider configFileProvider )
{
_urlBase = configFileProvider . UrlBase ;
}
public int Order = > 99 ;
public void Register ( IPipelines pipelines )
{
if ( _urlBase . IsNotNullOrWhiteSpace ( ) )
{
pipelines . BeforeRequest . AddItemToStartOfPipeline ( ( Func < NancyContext , Response > ) Handle ) ;
}
}
private Response Handle ( NancyContext context )
{
var basePath = context . Request . Url . BasePath ;
if ( basePath . IsNullOrWhiteSpace ( ) )
{
return new RedirectResponse ( $"{_urlBase}{context.Request.Path}{context.Request.Url.Query}" ) ;
}
if ( _urlBase ! = basePath )
{
return new NotFoundResponse ( ) ;
}
return null ;
}
}
}
@ -1,4 +1,4 @@
using System ;
using System ;
using System.Collections.Generic ;
using System.Linq ;
using Nancy.Responses ;
@ -38,20 +38,6 @@ namespace NzbDrone.Api.Frontend
return new NotFoundResponse ( ) ;
}
//Redirect to the subfolder if the request went to the base URL
if ( path . Equals ( "/" ) )
{
var urlBase = _configFileProvider . UrlBase ;
if ( ! string . IsNullOrEmpty ( urlBase ) )
{
if ( Request . Url . BasePath ! = urlBase )
{
return new RedirectResponse ( urlBase + "/" ) ;
}
}
}
var mapper = _requestMappers . SingleOrDefault ( m = > m . CanHandle ( path ) ) ;
if ( mapper ! = null )
@ -106,6 +106,7 @@
<Compile Include= "Commands\CommandResource.cs" />
<Compile Include= "Extensions\AccessControlHeaders.cs" />
<Compile Include= "Extensions\Pipelines\CorsPipeline.cs" />
<Compile Include= "Extensions\Pipelines\UrlBasePipeline.cs" />
<Compile Include= "Extensions\Pipelines\RequestLoggingPipeline.cs" />
<Compile Include= "Frontend\Mappers\LoginHtmlMapper.cs" />
<Compile Include= "Frontend\Mappers\RobotsTxtMapper.cs" />