JagandeepBrar / lunasea

Self-hosted software controller built using Flutter
https://www.lunasea.app
GNU General Public License v3.0
1.28k stars 63 forks source link

[Bug] Trailing slash in host isn't always stripped out #204

Closed nemchik closed 4 years ago

nemchik commented 4 years ago

Developer Note: The user found the solution by removing the trailing / from their host. LunaSea should be stripping/trimming the host, but it didn't work in this case so I need to investigate that logic.

Describe the Bug I'm not seeing any images (banners) for anything in Sonarr or Radarr. If I'm supposed to see images anywhere else in the app I'm not seeing them either. I'm have NZBHydra2 and NZBGet setup as well.

To Reproduce Open the app. Look anywhere there should be banners or images (the screenshots on the LunaSea website show banners for shows and movies). I'm not seeing them.

Expected Behaviour I'd like to see banners and images.

Screenshots Skipping for now.

Versions LunaSea Version: 2.1.0 (66) Radarr Version: 3.0.0.2871-ls5 by linuxserver.io (docker) Sonarr Version: 3.0.3.770-ls9 by linuxserver.io (docker)

Phone: Motorola moto z3 (Moto Z(3)) Android Version: 9 (28) Device (product): messi (messi_verizon) Rom: PDX29.84-51-11

Additional context I'm accessing through reverse proxies.

JagandeepBrar commented 4 years ago

Did you disable SSL authentication in the settings or have any custom authentication enabled?

nemchik commented 4 years ago

Did you disable SSL authentication in the settings

No. But since you mention it I tried it just now. It doesn't seem to make a difference when it's on or off. I've set it back to on since that's how it was originally.

or have any custom authentication enabled?

No. Here are the proxy configs I'm using:

https://github.com/linuxserver/reverse-proxy-confs/blob/master/sonarr.subfolder.conf.sample And https://github.com/linuxserver/reverse-proxy-confs/blob/master/radarr.subfolder.conf.sample

I haven't modified the files, they run exactly as they appear in those links.

JagandeepBrar commented 4 years ago

Can you try removing the second blocks which are redirecting the API routes?

location ^~ /sonarr/api { ... }

And

location ^~ /radarr/api { ... }

If that still doesn’t work, would you be comfortable sending at least one for your host + API key configurations? I am not able to reproduce it locally, so being able to see exactly what error is thrown will help pinpoint the issue.

If you are comfortable, shoot me an email to hello@lunasea.app. Once the testing is finished you can reset the API key and I’ll lose all access.

nemchik commented 4 years ago

Can you try removing the second blocks which are redirecting the API routes?

location ^~ /sonarr/api { ... }

And

location ^~ /radarr/api { ... }

I tried it, and it didn't make a difference. BTW those second locations are there for the purpose of allowing API access without any extra auth that might be added to the top location (to protect the web UI).

I'll email you an API key shortly.

nemchik commented 4 years ago

I figured it out!

I was including a trailing slash in the URL I was entering in LunaSea. Removing the trailing slash resolved the issue.

I mentioned in my email that I setup a second instance of sonarr, and I did not realize I had forgotten the trailing slash when setting up the second profile in LunaSea.

Somehow everything worked with the trailing slash except images and banners. Maybe this could be looked into more? Like trim the trailing slash automatically?

nemchik commented 4 years ago

P.s. with that, I'm going to reset my API key. Hopefully it's not needed anymore.

JagandeepBrar commented 4 years ago

Thanks for getting back to me with a solution, I didn't have a chance to touch your instance anyways, but yes you're good to reset it now!

I'll keep this issue open and continue looking into it, it does (or rather should) trim a trailing /, but clearly it didn't work for you in this case and so I'll have to see what might be causing it.

By any chance, do you remember if you had a trailing space after the ending /?

nemchik commented 4 years ago

By any chance, do you remember if you had a trailing space after the ending /?

Nope, there definitely wasn't.

I tested just now and was able to put the trailing slash back in. Connection test succeeded.

I then added a space after the trailing slash. Connection test succeeded.

I didn't check to see if banners would break when doing this (figured they might be cached).

JagandeepBrar commented 4 years ago

This has been fixed in https://github.com/LunaTools/LunaSea/commit/9736ab6b00fb04948763f96613504909e51688c4, and will be in the next TestFlight release/v3.1.0.