Skip to content

multiple folders as static directories #3402

Open
@robjtede

Description

@robjtede

Possible API

Files::new("/", ["./dist", "./public"])

Cavets

As noted in the discussion answers, this does make it hard to support options like show_index.

Discussed in #3398

Originally posted by Aobanana-chan June 10, 2024
For some reasons, I am migrating my website from Node.js/Fastify to Actix Web, but I am having some difficulties setting up static directories. I tried to mount two directories, "./public" and "./dist" to "/", but it failed.
Here is a simplified example code:

App::new()
            .service(Files::new("/", "./dist"))
            .service(Files::new("/", "./public"))

In the first service, if the file is not found, it directly responds with a 404 instead of moving to the next service. I realize this approach doesn't work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-featureCategory: new functionalityd-mediumDifficulty (estimate): Medium

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions