Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring Jackett under a domain without subpath redirects to http://ui/Dashboard, ignoring base URL #12954

Closed
3 tasks done
tjakubo opened this issue Feb 14, 2022 · 13 comments
Closed
3 tasks done

Comments

@tjakubo
Copy link

tjakubo commented Feb 14, 2022

Have you checked our Troubleshooting page for your issue?

  • I have checked the Troubleshooting page

Is there already an issue for your problem?

  • I have checked older issues, open and closed

Have you read our Contributing Guidelines?

  • I have read the Contributing Guidelines

Environment

Using HTTP Client: HttpWebClient2
Using FlareSolverr: No
Using proxy: Disabled
App config/log directory: /home/[user]/.config/Jackett
ThreadPool MaxThreads: 32767 workerThreads, 1000 completionPortThreads
Running in Docker: No
File /etc/issue: \S
Jackett variant: CoreLinuxAmdx64
OS version: Unix 4.18.0.240 (64bit OS) (64bit process)
Environment version: 6.0.2 (/home/[user]/Jackett/)

Description

The issue is that under Nginx w/ reverse proxy, when hosting Jackett under a domain directly (without subpath), opening that URL redirects to http://ui/Dashboard, ignoring any base URL set. Maybe it's misconfiguration on my part, so I'm listing steps that I've done here.

Worth noting:
Jackett works, as in responds to requests. Accesing the Web UI under http://subdomain.mydomain.com/ui/dashboard also works. It's just accessing http://subdomain.mydomain.com that redirects to a malformed address http://ui/Dashboard without prefixing it with set base URL (subdomain.mydomain.com)

Steps:

  1. Installed Jackett as a service (CentOS 8)
  2. Configured my domain subdomain.mydomain.com
  3. Configured Jackett to run under localhost setting these lines in ServerConfig.json
  "Port": 9117,
  "AllowExternal": true,
  "BasePathOverride": "",
  "BaseUrlOverride": "subdomain.mydomain.com",

(other lines left default)
4. Set up a reverse proxy on it under Nginx with this config file, following https://github.com/Jackett/Jackett/wiki/Reverse-Proxy

server {
    listen 80;
    server_name subdomain.mydomain.com;

    location / {
        proxy_pass         http://127.0.0.1:9117;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   X-Forwarded-Host $http_host;
    }
}
  1. Restarted nginx and jackett services

Expected result:

  • Jackett responds to queries
  • Opening http://subdomain.mydomain.com redirects me to Jackett Web UI

Observed result:

  • Jackett responds to queries
  • Opening http://subdomain.mydomain.com redirects me to http://ui/dashboard
  • Opening http://subdomain.mydomain.com/ui/dashboard opens Jackett Web UI

Logged Error Messages

No error logged

Screenshots

No response

@ilike2burnthing
Copy link
Contributor

Base URL override is purely for use for Docker users, and should only affect the Copy * Feed buttons. Try removing that from the config file, restarting Jackett, and seeing if your issue continues.

I'll edit https://github.com/Jackett/Jackett/wiki/Reverse-Proxy to clarify the wording.

@tjakubo
Copy link
Author

tjakubo commented Feb 15, 2022

It seems that changing BaseUrlOverride property to both empty string and null doesn't change anything.
Same with BasePathOverride, which I also tried because why not.

Would there be any verbose logging for me to enable and post there?

BTW. If I open the problematic URL unauthorized, it correctly redirects to http://subdomain.mydomain.com/UI/Login?ReturnUrl=%2FUI%2FDashboard. But then, like ReturnUrl suggests, it redirects to http://ui/Dashboard after entering the password.

@ilike2burnthing
Copy link
Contributor

If you use \jackett (and change your nginx config file), does that resolve your issue?

@Zamana you had an issue with getting a subdomain reverse proxy to work in #8872 (comment), did you manage to resolve it? Anything here jumping out to you as an issue?

@tjakubo
Copy link
Author

tjakubo commented Feb 15, 2022

Yes, with location /jackett in Nginx config and "BasePathOverride": "/jackett", it works great.

As in, opening http://subdomain.mydomain.com/jackett correctly redirects to http://subdomain.mydomain.com/jackett/ui/Dashboard and it all works.

@ilike2burnthing
Copy link
Contributor

And is that an acceptable solution; can this issue be closed?

@tjakubo
Copy link
Author

tjakubo commented Feb 15, 2022

I mean, sure, as I noted in the first post, I got the system working in general. It's just that there seems to be a bug, workable around, but kinda annoying to debug because none of the Jackett config seems to affect it at all.

If you decide it's not worth dev time, or we simply should be using a subpath, feel free to close this issue.

@ilike2burnthing
Copy link
Contributor

I'll see if @Zamana found a solution that I'm missing first.

I'm happy to mark this as a feature request, it's just not something I'd have the knowhow to work on.

@Zamana
Copy link

Zamana commented Feb 15, 2022

Hi!

I'm not quite sure that I understood the issue properly, so I'm sorry if this is irrelevant to the question... Anyway...

In my environment, I have a local DNS and all my "*arrs" (and jackett and plex and qbittorrent etc) are behind an Nginx reverse proxy, in such a way that I access all of them like radarr.local, sonarr.local, jackett.local and so on.

Specifically, the Jackett reverse proxy is configured like this:

server {
        listen       80;
        server_name  jackett.local;

        location / {
                proxy_pass http://192.168.0.105:9117;
                proxy_http_version 1.1;
                proxy_set_header   Upgrade $http_upgrade;
                proxy_set_header   Connection keep-alive;
                proxy_cache_bypass $http_upgrade;
                proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header   X-Forwarded-Proto $scheme;
                proxy_set_header   X-Forwarded-Host $http_host;
        }
    }

Where 192.168.0.105 is the IP of the jackett's jail.

@tjakubo
Copy link
Author

tjakubo commented Feb 15, 2022

@Zamana
Thank you, it seems to be the same config as mine.
Could you check if opening http://jackett.local does open the web UI dashboard for you?

@Zamana
Copy link

Zamana commented Feb 16, 2022

Yes. Automagically:

rproxy

@tjakubo
Copy link
Author

tjakubo commented Feb 16, 2022

Okay, this is some isolated issue of mine then. I'd appreciate if you could post relevant parts of your ServerConfig.json, and I'll just get to more detailed troubleshooting on my side.

Since this does not seem to be a straight up reproducible issue, I'm closing the issue; will reopen/comment if I nail it down :)

Thanks A LOT for helping me out with this :)

@tjakubo tjakubo closed this as completed Feb 16, 2022
@Zamana
Copy link

Zamana commented Feb 16, 2022

{
  "Port": 9117,
  "AllowExternal": true,
  "APIKey": "xxxxxxxxxxxxxxxxxxxxxxx",
  "AdminPassword": null,
  "InstanceId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "BlackholeDir": "",
  "UpdateDisabled": false,
  "UpdatePrerelease": false,
  "BasePathOverride": "",
  "CacheEnabled": true,
  "CacheTtl": 2100,
  "CacheMaxResultsPerIndexer": 1000,
  "FlareSolverrUrl": "http://192.168.0.103:8191",
  "OmdbApiKey": "",
  "OmdbApiUrl": "",
  "ProxyType": -1,
  "ProxyUrl": "",
  "ProxyPort": null,
  "ProxyUsername": "",
  "ProxyPassword": "",
  "ProxyIsAnonymous": true
}

@matvey00z
Copy link

matvey00z commented Nov 7, 2022

Hi, I am experiencing similar issue here, with jackett in docker behind nginx.

  1. Open jackett.mydomain.com for the first time.
    Request: jackett.mydomain.com, Response: 301, Location: /UI/Dashboard
    Request: jackett.mydomain.com/UI/Dashboard, Response: 302, Location: http://jackett:9117/UI/Login?ReturnUrl=%2FUI%2FDashboard
    And I end up with an 'error loading page' (no surprise)

  2. Open jackett.mydomain.com/UI/Login?ReturnUrl=%2FUI%2FDashboard (change jackett:9117 to the correct domain)
    Request: https://jackett.mydomain.com/UI/Login?ReturnUrl=/UI/Dashboard, Response: 302, Location: /UI/Dashboard
    The UI loads properly

  3. Open jacket.mydomain.com
    Request: jackett.mydomain.com, Response: 301, Location: /UI/Dashboard
    The UI loads properly

So that reproduces only once, when the site is opened for the first time (e.g. in a private tab), and after that it works properly.
Also, it doesn't matter if the BasePath is set or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants