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

wai-app-static does not redirect on folders #312

Closed
tolysz opened this issue Dec 11, 2014 · 5 comments
Closed

wai-app-static does not redirect on folders #312

tolysz opened this issue Dec 11, 2014 · 5 comments

Comments

@tolysz
Copy link
Contributor

tolysz commented Dec 11, 2014

Hi,

I run into this serving static folders, the issue is when

somefolder/
     index.html  ( <img src="picture.jpg" /> )
     picture.jpg

Now whenever I request https://example.com/somefolder I have broken picture box
and whenever https://example.com/somefolder/ not.

The former tries to access picture.jpg from /picture.jpg the later /somefolder/picture.jpg

The solution could be to Redirect if the Pieces elements point to a folder but does not have / if it has some pathpieces in them (not the clean root)

@snoyberg
Copy link
Member

Is this occurring using yesod-static inside a Yesod app, or directly using wai-app-static? Can you give a minimal reproducing example if the latter?

There are some latent issues with yesod-static when using directory listings, I don't remember the details offhand, but I think it's related.

@tolysz
Copy link
Contributor Author

tolysz commented Dec 11, 2014

any application which uses wai static e.g.

 mkdir subfolder
 cp pix.png subfolder
 start warp
 navigate to http://127.0.0.1:3000/subfolder
 click on pix.png (404)
 navigate to http://127.0.0.1:3000/subfolder/
 click on pix.png ( works )

The most probable candidates are:
wai/wai-app-static/Network/Wai/Application/Static.hs # setLast and serveFolder to redirect to path + / if it is not root nor it ends on /

@snoyberg
Copy link
Member

OK, I think I know where the problem is coming from, though I'll probably only have time to look at this in the middle of next week.

@snoyberg
Copy link
Member

I believe this is now fixed, can you check the newest master?

@tolysz
Copy link
Contributor Author

tolysz commented Dec 15, 2014

looks good

@tolysz tolysz closed this as completed Dec 15, 2014
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