2015-06-11, 15:56
Summary
I can't get Kodi's web server to work properly behind an Apache virtual host configured solely through a .htaccess file, and I'm wondering if anyone else has succeeded in doing this, or can offer any advice that doesn't involve modifying global Apache configuration files. More details follow.
Background
Kodi has a built-in web server for remote control, typically served on a non-standard port.
It's possible to place Kodi's web server behind an Apache virtual host, which is useful for exposing the interface on a standard port, thereby removing the need to remember the custom port number or open additional ports to the outside world. Instructions even exist on the wiki for doing exactly this, but they assume write access to Apache's global configuration files and are not tailored for a setup where .htaccess files are the only possible configuration source.
My goal
I can access Kodi's web interface internally using http://<kodi-host>:<kodi-port>, but I want to instead access it via https://kodi.my-lan.net (where "my-lan.net" is a pseudonym for a real-world domain name that points to my home LAN). I have a Synology NAS running Apache on ports 80 and 443, with both ports exposed to the outside world. Apache virtual hosts therefore seem like the answer to my goal.
My problem
My Synology NAS doesn't give me direct write access to Apache's global configuration files. I can only use .htaccess files. I'm using this one for kodi.my-lan.net:
While this results in a mostly-working Kodi web interface, no movie/show images load; a 404 is returned instead for these.
The wiki instructions for this say that "[the] AllowEncodedSlashes [directive] is necessary to have webpages work properly." However, this directive isn't permitted inside a .htaccess file.
I've tried an additional RewriteRule that specifically targets image URLs with the B flag, but this didn't help, probably because it too relies on the AllowEncodedSlashes directive being enabled.
Questions
I can't get Kodi's web server to work properly behind an Apache virtual host configured solely through a .htaccess file, and I'm wondering if anyone else has succeeded in doing this, or can offer any advice that doesn't involve modifying global Apache configuration files. More details follow.
Background
Kodi has a built-in web server for remote control, typically served on a non-standard port.
It's possible to place Kodi's web server behind an Apache virtual host, which is useful for exposing the interface on a standard port, thereby removing the need to remember the custom port number or open additional ports to the outside world. Instructions even exist on the wiki for doing exactly this, but they assume write access to Apache's global configuration files and are not tailored for a setup where .htaccess files are the only possible configuration source.
My goal
I can access Kodi's web interface internally using http://<kodi-host>:<kodi-port>, but I want to instead access it via https://kodi.my-lan.net (where "my-lan.net" is a pseudonym for a real-world domain name that points to my home LAN). I have a Synology NAS running Apache on ports 80 and 443, with both ports exposed to the outside world. Apache virtual hosts therefore seem like the answer to my goal.
My problem
My Synology NAS doesn't give me direct write access to Apache's global configuration files. I can only use .htaccess files. I'm using this one for kodi.my-lan.net:
Code:
RewriteEngine on
# redirect all external http:// traffic to https://
RewriteCond %{SERVER_PORT} 80
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [redirect=301,last]
# proxy all requests to the Kodi box
RewriteRule ^(.*)$ http://kodi-host.my-lan.net:55555/$1 [proxy,last]
While this results in a mostly-working Kodi web interface, no movie/show images load; a 404 is returned instead for these.
The wiki instructions for this say that "[the] AllowEncodedSlashes [directive] is necessary to have webpages work properly." However, this directive isn't permitted inside a .htaccess file.
I've tried an additional RewriteRule that specifically targets image URLs with the B flag, but this didn't help, probably because it too relies on the AllowEncodedSlashes directive being enabled.
Questions
- Can anyone suggest changes to my .htaccess file to increase my success?
- If not, is it possible to change how Kodi's web interface requests images (i.e. without the use of slashes)?