Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 5 of 5

Thread: change webroot

  1. #1
    Junior Member
    Join Date
    Feb 2006
    Posts
    12

    change webroot

    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|^/+||;

    }
    Last edited by srvduplex; 2017-05-18 at 07:07.

  2. #2
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    2,843
    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.
    Pi3 with piCoreplayer music on QNAP TS419p via NFS iThingys/iPeng/Tablets/Jogglers
    Living Room - Joggler & SB3 -> Onkyo TS606 - > Celestion Ditton F20s
    Office - Pi -> Sony TA FE320 -> Celestion F10s / Pi & SB3 -> Onkyo CRN 755 -> Wharfedale Modus Cubes
    Dining Room -> SB Boom Kitchen -> UE Radio (upgraded to SB Radio)
    Bedroom (Bedside) - SB Touch -> Topping TP21 -> AKG Headphones

  3. #3
    Junior Member
    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

  4. #4
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    649
    Quote Originally Posted by srvduplex View Post
    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

    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 :-)
    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.

  5. #5
    Junior Member
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •