trame icon indicating copy to clipboard operation
trame copied to clipboard

aiohttp ignores symlinks, trame server options

Open PathosV opened this issue 2 months ago • 2 comments

Is your feature request related to a problem? Please describe.

I use uv with symlinks to manage my python environments on an hpc cluster, links are useful for us since we have multiple mounted drives. After a lot of testing I found that the symlink venv structure was the reason my trame apps almost always gave a 404 error. If I installed with the default hardlinks the app worked fine.

Describe the solution you'd like

Ideally, since aiohttp already has an option to turn on symlinks, "follow_symlinks = True", exposing it as a server.start kwarg makes sense to me.

Describe alternatives you've considered The following monkey patch is my current solution.

    # Patch aiohttp to follow symlinks
    import aiohttp.web
    original_static = aiohttp.web.static

    def patched_static(prefix, path, **kwargs):
        kwargs['follow_symlinks'] = True
        print(f"Registering static route with symlink support: {prefix} -> {path}")
        return original_static(prefix, path, **kwargs)

    aiohttp.web.static = patched_static
    server.start()

Additional context

N/A

PathosV avatar Oct 19 '25 04:10 PathosV

Thanks for sharing your workaround. We'll see how to best enable such option.

jourdain avatar Oct 20 '25 15:10 jourdain

Should be fixed in https://github.com/Kitware/trame-server/releases/tag/v3.7.0 when you use the --follow-symlinks arg.

Please report back if that works for you.

jourdain avatar Oct 20 '25 15:10 jourdain