Skip to content

aiohttp ignores symlinks, trame server options #816

Description

@PathosV

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions