BlitterStudio / MB_SubSonic

MusicBee SubSonic plugin
GNU General Public License v3.0
115 stars 13 forks source link

Unable to connect to server with nginx authentication configured #24

Closed kkuhle closed 1 year ago

kkuhle commented 7 years ago

I am trying to get musicbee to connect to my libresonic server with this plugin. When I hit apply, I get the error message that the server did not respond as expected.

I have tried http://your-server/rest/ping.view?u=joe&p=sesame&v=1.12.0&c=myapp which comes back with ""

When I click "No" to the save anyway prompt it shows "Error: There is an error in XML document (1,2).

I am using a docker libresonic which is behind an nginx reverse proxy. I was able to get this working locally.

kkuhle commented 7 years ago

@weirdcrap I was looking at the enhancement that @midwan fulfilled to make libresonic compatible with his plugin. I am also using the linuxserver.io docker behind nginx. Perhaps there is something wrong with my config since I'm finding it will work locally. Do you use a context_path such as libresonic? Would you be willing to share your config that you're using in your sites file for libresonic?

midwan commented 7 years ago

@kkuhle I've recently installed a libresonic server here, which is also using Docker (on a FreeNAS 10 machine), so I can easily test it locally and see.

The recent update added support for Libresonic responses, so using the latest version should work with it without problems (before that you would get the invalid response from server message).

Could you verify you're using the latest version please?

weirdcrap commented 7 years ago

@kkuhle I use a subdomain of my main personal domain: libresonic.mydomain.com

This is the relevant section from my nginx reverse proxy configuration: `## LibreSonic Server ## server { listen 80; server_name libresonic.yourdomain.com; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://xxx.xxx.xxx.xxx:4040; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; } }'

midwan commented 7 years ago

@weirdcrap Thanks for sharing :)

Meanwhile, I just confirmed that the plugin works with my LibreSonic installation locally. Tomorrow I can try a remote connection also, just in case. If that seems to work as well, and @kkuhle still can't connect, perhaps we can look into the specifics of that environment.

kkuhle commented 7 years ago

@midwan My version says "6.1 – April 7, 2017"

@weirdcrap Thanks. I am using SSL for libresonic, so perhaps this is causing an issue. As I said before, locally it is working, but it does http locally. I will reconfigure nginx to use http to see if it works that way.

midwan commented 7 years ago

@kkuhle I was referring to the plugin version, it should be at least v2.10: image

kkuhle commented 7 years ago

@midwan My mistake. It should be 2.10 however the plugin does say

image

I downloaded the 2.10 beta version and the file name is MB_SubSonic_v2.10beta.7z

midwan commented 7 years ago

@kkuhle Ok then - I forgot that the version shows in the latest version only ;) If you're on v2.10 then it should work.

The only change in v2.11 is the status display (it will show relevant messages while scanning a folder), I was waiting for some feedback from Steven to fix another item before releasing it.

kkuhle commented 7 years ago

@midwan It is working! I switched my config to do http rather than https in nginx for libresonic. So for some reason https is breaking it. I don't mind using http for this site though.

midwan commented 7 years ago

@kkuhle Great news! Do you have a valid certificate for HTTPS? If not, maybe that's causing an issue.

Generally the plugin does work with HTTPS connections as well...

kkuhle commented 7 years ago

So I set libresonic up a while back. My nginx is using a valid ssl certificate from letsencrypt. It works great on all of my other websites. With libresonic however it looks like this image

If you look on the right of the url bar there is a little indicator that I have noticed I clicked on and it displays all portions of the page. Before clicking this I can access my music, but not all the settings and such. When I click on it, it says that it is no longer trusted.

There seems to be no way in this docker container to tell it to use https from what I am finding that would maybe fix this?

Anyway, it seems the issue is with using https in the fashion that I have tried. Not a problem with your plugin

weirdcrap commented 7 years ago

I believe what it is doing is hiding all elements that are not "secure" until you actively allow them. So it seems like the issue is that some parts of your libresonic interface are not being transmitted securely and your browser is hiding them.

As for any configuration you may need to make in the docker, you should probably post on the linux.io forum.

kkuhle commented 7 years ago

@weirdcrap

I agree with you that I should talk to linuxserver.io about it. I've just never been too concerned about it since everything I need works fine. Might still ask them about it though.

kkuhle commented 7 years ago

@midwan

So I was thinking about this earlier and just got a chance to test it. I am using basic auth for my https sites in nginx. I just turned it off for libresonic and it works normally with https.

I think I didn't consider this is because I use dsub on my Android which works fine. What I have done is configured an nginx auth user with the same credentials as my libresonic user and it connects to the server normally.

Maybe the plugin can be modified to allow something like this?

kkuhle commented 7 years ago

@midwan

I went ahead and updated the title of this bug since the issue for me seemed to be occurring because nginx auth was set up. Now that I've got it working with nginx auth turned off, I can live with it. However it would be nice to use nginx auth again as I prefer having it on as I've configured fail2ban to block IPs and it is unable to do this with the basic auth turned off.

If it would help, I can set up a user for you to test with.

No rush, but if this can be looked at, that would be cool.

jomant commented 7 years ago

I have a valid HTTPS certificate, runs website, TeamSpeak3 Subsonic Server (freeNAS), Nextcloud, Space Engineers Servers. Got 2 Dell Power Edge and a Intel....whatever 12 Bay NAS. I can access the Subsonic Server remotely via SoundWave, D Sub and the Web player without any issues. I changed the Port from 80 to 443 (for HTTPS) still nothing. The database is approx. 120 GB big..... any guess how long this could take? Or any kind of other way to see even if the sync process starts?

midwan commented 7 years ago

@jomant The latest version of the plugin displays a status update during scanning in MusicBee (at the bottom left)

midwan commented 3 years ago

Please test with the latest release: https://github.com/midwan/MB_SubSonic/releases/tag/v2.30

The problematic pre-caching is removed, and files/folders are only loaded on-demand now. Hopefully that should make it work better for you?

midwan commented 1 year ago

Closing this as there hasn't been any activity for quite a while now.