Jalle19 / xbmc-video-server

Web interface for streaming or downloading media from a Kodi/XBMC library
GNU General Public License v3.0
191 stars 39 forks source link

Backend hostname from URL case #326

Closed alanmilinovic closed 5 years ago

alanmilinovic commented 5 years ago

I know there is a posibility to add more backends and switch between then while using xbmc server web application. In my case I use backend that is located on the same machine (raspberry pi) where xbmc server is installed.

What I did of course I configured in my xbmc server backend, fixed IP address (192.168.188.201) for the "hostname". Thing is that sometimes I open application inside my home with IP and sometimes I open it outside from my home. In case when I use it outside, hostname should be this "1raspberrypi.mooo.com" and if I use it with this domain name and try to download some video it is pointing to local IP. What of course doesn't work for that case.

Is it possible to add an option in backend record to support getting backend hostname by parsing of hostname from the URL? I think this "$_SERVER['SERVER_NAME']" should be used if this type of backends are marked with checkbox for example. Not sure on how many places you use backend hostname from the database in code but should be easy to implement it, I think, of course if you have free time and want to do it. It would be highly appreciated. :)

alanmilinovic commented 5 years ago

Any comments? Does it make sense?

Jalle19 commented 5 years ago

A proper solution would be to make sure your hostname resolves correctly on your local network, then you wouldn't need any hacks like this.

alanmilinovic commented 5 years ago

How to achieve that?

Jalle19 commented 5 years ago

Actually, take a look at https://github.com/Jalle19/xbmc-video-server/wiki/Configuring-a-reverse-proxy. With that configured you can use the IP address for youe backend while accessing the application from "outside" too.

alanmilinovic commented 5 years ago

Don't like reverse proxy solution that much though. I also need to put password in apache2 config file. Personally I think my feature request is quite ok. :)

Jalle19 commented 5 years ago

Reverse proxying has it's problems, but IMO it's the best solution here. I'm not completely sure how your suggestion is supposed to work either so it's hard to say. Generally you don't want to have your application work around network configuration problems.

Jalle19 commented 5 years ago

Actually I now understand what you mean, although it would only work if you run the backend and this application on the same machine, right?

alanmilinovic commented 5 years ago

Yes, it should be a flag where you configure backend, like a property on the form. In case when user set flag to true, hostname field can be disabled, because it is then taken from URL and not needed.

alanmilinovic commented 5 years ago

I reopened the issue in case you decide to implement it. :) If you are not planning to give it a go, please close the issue.

Jalle19 commented 5 years ago

Since it would only work if the application is installed on the same machine as the backend I'm not really comfortable implementing such a workaround. It's much better to just configure a reverse proxy instead.

alanmilinovic commented 5 years ago

Your suggestion with reverse proxy is working. In my case, I configured "localhost" for the Backend hostname and in Apache config as well for the url.

As already mentioned I had to configure Kodi url and credentials one more time in Apache, what I find not so comfortable about but I will have to live with it. Thank you for your support.