Mozilla-Ocho / llamafile

Distribute and run LLMs with a single file.
https://llamafile.ai
Other
20.58k stars 1.04k forks source link

Support for configurable URL prefix in llamafiler #604

Closed vlasky closed 3 weeks ago

vlasky commented 3 weeks ago

Added support for new llamafiler commandline parameter --url-prefix or -u

This specifies a URL prefix (subdirectory) under which the llamafiler HTTP server will make the API accessible, e.g. /lamafiler.

Useful when running llamafiler behind a reverse proxy such as NGINX or Redbean.

By default, this is set to / (root).

vlasky commented 3 weeks ago

This is a sequel to https://github.com/Mozilla-Ocho/llamafile/pull/597 which added configurable URL prefix support to the llamafile command.

I felt a bit perplexed by the existing llamafiler codebase, which seems to be a scattered mix of C and C++ code, so I implemented this in a manner that I considered understandable.

Wondering if the short form version of commandline parameter -u should be renamed as perhaps this could be mistaken for something else?