THttpServer / location

Hello,
I am not sure if it is documented (not seen on HTTP Server) or if it would require internal modifications: can we do server->AddLocation("/", "ui"); and change / such that:

  • doing a request http://localhost/ serves /index.html by default (like many webservers, for example on Apache: DirectoryIndex index.html =>
    a request for http://example.com/docs/ would return http://example.com/docs/index.html)
  • the root path of all ROOT internal objects (usually on /) would become /root/, for example server->Register("/graph1", graph1); would become /root/graph1.

Best regards.

Hi,

ROOT http server designed not to serve file-based HTML pages but rather ROOT objects.
Therefore all registered objects starts serving from top / path. Changing to /root/ will have many side-effects for existing applications.

To assign default HTML page for THttpServer one should use SetDefaultPage() method. See how it used in custom.C demo.

Be careful - with such call you register graph1 object in /graph1 folder.
Therefore path name in THttpServer will be /graph1/<graph1_name> - depending that graph1->GetName() returns.

1 Like

Thank you very much!