Hi everybody,
I placed my slimserver behind a reverse proxy, and I would like to change the webroot, I think I found the right document to modify in Slim/Web/HTML.pm
so my interest is to access to the server typing www.myadress.com/slimserver instead of www.myadress.com:9000
in the script HTML.pm I found the following lines corresponding to the webroot access, but as no expert in perl, I can't find the right way to change the webroot, and in the wiki, the script is different.
I tried $params->{'webroot'} = '/'; changed in $params->{'webroot'} = '/slimserver/'; but as said in the wiki it is the "wrong way to do it" and it won't work
Any help to understand where to implement /slimserver/ as webroot will be much granted :-)
Thank you
# Skins
if ($path) {
$params->{'webroot'} = '/';
$path =~ s|^/+||;
if ( !main::WEBUI || $path =~ m{^(?:html|music|video|image|plugins|apps|settings |firmware|clixmlbrowser|index\.html|imageproxy)/}i || Slim::Web::Pages->isRawDownload($pa
# not a skin
} elsif ($path =~ m|^([a-zA-Z0-9]+)$| && $skinMgr->isaSkin($1)) {
main::DEBUGLOG && $isDebug && $log->info("Alternate skin $1 requested, redirecting to $uri/ append a slash.");
$response->code(RC_MOVED_PERMANENTLY);
$response->header('Location' => $uri . '/');
$httpClient->send_response($response);
closeHTTPSocket($httpClient);
return;
} elsif ($path =~ m|^(.+?)/.*|) {
my $desiredskin = $1;
# Requesting a specific skin, verify and set the skinOverride param
main::DEBUGLOG && $isDebug && $log->info("Alternate skin $desiredskin requested");
my $skinname = $skinMgr->isaSkin($desiredskin);
if ($skinname) {
main::DEBUGLOG && $isDebug && $log->info("Rendering using $skinname");
$params->{'skinOverride'} = $skinname;
$params->{'webroot'} = $params->{'webroot'} . "$skinname/";
$path =~ s{^.+?/}{/};
$path =~ s|^/+||;
}
Results 1 to 5 of 5
Thread: change webroot
-
2017-05-18, 05:25 #1
- Join Date
- Feb 2006
- Posts
- 12
change webroot
Last edited by srvduplex; 2017-05-18 at 07:07.
-
2017-05-19, 08:30 #2
- Join Date
- Feb 2011
- Location
- Cheshire, UK
- Posts
- 3,005
Can we ask - why?
Knowing why might illicit an alternative method of doing what you want. An obvious one being forget the reverse proxy just switch off Apache and run LMS on port 80.VB2.4 storage QNAP TS419p (NFS)
Living Room - Joggler & SB3 -> Onkyo TS606 -> Celestion F20s
Office - Pi3+Sreen -> Sony TAFE320 -> Celestion F10s / Pi2+DAC & SB3 -> Onkyo CRN755 -> Wharfedale Modus Cubes
Dining Room -> SB Boom
Kitchen -> UE Radio (upgraded to SB Radio)
Bedroom (Bedside) - Pi2+DAC ->ToppingTP21 ->AKG Headphones
Bedroom (TV) - SB Touch ->Sherwood AVR ->Mordaunt Short M10s
Everything controlled by iPeng
-
2017-05-19, 09:04 #3
- Join Date
- Feb 2006
- Posts
- 12
change webroot
Hi d6jg,
Thank you for your comment
The slimserver is on my Nas Synology, and I use Haproxy. In order to get it work on my other web app I just changed the webroot and then created a condition if path_beg /appname to access via myaddress.com/appname.
I just want to avoid using port number anymore.
cheers
-
2017-05-19, 09:40 #4
- Join Date
- Aug 2012
- Location
- Austria
- Posts
- 736
There is no need to change the code, you should configure your proxy to do the mapping.
That being said, you should read this thread and re-evaluate if this is a good idea in the first place.
-
2017-05-22, 05:16 #5
- Join Date
- Feb 2006
- Posts
- 12
webroot
Hi,
I finally didn't change the code as you recommended, but I used the skinname instead of my desired /slimserver.
so I did map my proxy to root the request myaddress.com/skinname to localhost:9002/skinname.
so the webroot in the slimserver is the skinname.
it works fine
thank you for the help that help me to find out a solution.