Config libreNMS container under a prefix folder to use a reverse proxy on apache

Hello Helpers,
I am little bit lost with librenms container.
I try to get a suffix on url to be able to use a reverse proxy with an ingress apache2.
I had to be in https apache Handle this and I force laravel to be in https “\URL::forceScheme(‘https’);”
I am not able to use a subdomain.
I tried to Change
name: APP_URL
value: ‘/librenms/’
or
LIBRENMS_BASE_URL
‘/librenms/’
nothing change.
I modified the
/opt/librenms/app/Providers/RouteServiceProvider.php
public function boot()
{
//$this->configureRateLimiting();

    $this->routes(function () {
                                 
        /**
         * Define the "api" routes for the application.
         *                                      
         * These routes are typically stateless.
         */                                                                                       
        Route::prefix('librenms/api')
             ->middleware('api')
             ->namespace($this->namespace)
             ->group(base_path('routes/api.php'));

        /**
         * Define the "web" routes for the application.   
         *
         * These routes all receive session state, CSRF protection, etc.
         */
        Route::prefix('librenms')
             ->middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/web.php'));
    });                        
}

I changed the url function add a suffix to change link in

/opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php

if (! function_exists(‘url’)) {
/**
* Generate a url for the application.
*
* @param string|null $path
* @param mixed $parameters
* @param bool|null $secure
* @return \Illuminate\Contracts\Routing\UrlGenerator|string
*/
function url($path = null, $parameters = [], $secure = null)
{
if (is_null($path)) {
return app(UrlGenerator::class);
}

    $path='librenms/'. $path;                                                                          
                                                                                                              
    return app(UrlGenerator::class)->to($path, $parameters, $secure);                                                  
}                                                                                      

}

Some links working well some other display “404 not found”
I spent around 4 days on that issue.
I just want to be able to use a reverse proxy with apache 2 and the librenms container inclu nginx.
Do you have an easy way to do it please?

Subdirectories are kind of a mess. I think you may need a rewrite rule in apache too.

We are trying to move everything to Laravel route/url helpers which will generate correct urls, but LibreNMS is large and some are complex.

Any help updating links would be great (small PRs only though).

If you want the easy way, subdomains work without issue.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.