Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running jetlog under a subdirectory (path prefix) #70

Open
SaswatPadhi opened this issue Jan 6, 2025 · 1 comment
Open

Support running jetlog under a subdirectory (path prefix) #70

SaswatPadhi opened this issue Jan 6, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@SaswatPadhi
Copy link

I am running jetlog behing a reverse proxy and would love to be able to host it under a path prefix, say /jetlog. I tried stripping the prefix before forwarding to the server, but couldn't fix a way to tweak the paths internally generated by the app. For example:

<link rel="stylesheet" href="/index.5d77d0b2.css">

should be

<link rel="stylesheet" href="/jetlog/index.5d77d0b2.css">

Not super familiar with the tech stack, but I'd be happy to create a PR if you could point me where to look. Thanks!

@pbogre pbogre added the enhancement New feature or request label Jan 7, 2025
@pbogre
Copy link
Owner

pbogre commented Jan 7, 2025

Thank you for opening this issue. This problem lies in the server, so FastAPI. Fortunately FastAPI has a way of handling this, by setting the path prefix for the docs, openapi, and static files and routers:

app = FastApi(docs_url = path_prefix + '/docs', 
        openapi_url = path_prefix + '/openapi.json')
app.include_router(router, prefix=path_prefix + '/whatever') # done for each router
app.mount(path_prefix, StaticFiles(...))

That is just a draft of what this change would require, but it's not too hard. A project that uses FastAPI and has done this can be seen here.

Of course we would also need a docker variable to get this prefix from, and its default should be "/" or something. This is also done in the linked project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants