Better reverse proxy support

Added "base path override" config option that makes all links and
redirects work with your reverse proxy.
Fixed post config update reload to work properly.
Make redirects and ajax calls use relative pathing.
This commit is contained in:
Michael Robinson
2016-01-08 15:45:08 -07:00
parent 71c583d359
commit 42ec634cd3
10 changed files with 100 additions and 62 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.Owin;
using Jackett.Services;
using Microsoft.Owin;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,7 +12,7 @@ namespace Jackett.Utils
{
public WebApiRootRedirectMiddleware(OwinMiddleware next)
: base(next)
{
{
}
public async override Task Invoke(IOwinContext context)
@@ -21,7 +22,9 @@ namespace Jackett.Utils
{
// 301 is the status code of permanent redirect
context.Response.StatusCode = 301;
context.Response.Headers.Set("Location", "/Admin/Dashboard");
var redir = Startup.BasePath + "Admin/Dashboard";
Engine.Logger.Info("redirecting to " + redir);
context.Response.Headers.Set("Location", redir);
}
else
{