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

prefix and static file serving interact badly #168

Closed
adwhit opened this issue Apr 8, 2018 · 3 comments
Closed

prefix and static file serving interact badly #168

adwhit opened this issue Apr 8, 2018 · 3 comments

Comments

@adwhit
Copy link
Contributor

adwhit commented Apr 8, 2018

Take the following app:

App::new()
    .prefix("/public")
    .handler("/", fs::StaticFiles::new("some/folder")
             .index_file("index.html"));

Test with httpie:

➜  ~ http :8000/public/
HTTP/1.1 302 Found
location: /public/index.html

➜  ~ http :8000/public 
HTTP/1.1 302 Found
location: /publicindex.html

The second test generates an incorrect redirect.

@adwhit
Copy link
Contributor Author

adwhit commented Apr 8, 2018

I think the prefix is actually irrelevant. I get the same error with

App::new()
    .handler("/nested", fs::StaticFiles::new("some/folder")
            .index_file("index.html"))

@adwhit
Copy link
Contributor Author

adwhit commented Apr 8, 2018

I also find this slightly surprising

    App::new()
        .handler("nested", fs::StaticFiles::new("some/folder")
                 .index_file("index.html"))
➜  ~ http :8000/nested
HTTP/1.1 404 Not Found

In general I would not expect the forward slashes either before or after the prefix or the handler route to affect the routing. But this may be expected behavior.

@fafhrd91
Copy link
Member

fixed by 81ac905

kingoflolz pushed a commit to kingoflolz/actix-web that referenced this issue Apr 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants