erlyaws / yaws

Yaws webserver
https://erlyaws.github.io
BSD 3-Clause "New" or "Revised" License
1.28k stars 268 forks source link

Yaws should serve static files for appmods #5

Closed ngocdaothanh closed 15 years ago

ngocdaothanh commented 15 years ago

If there are:

More information: http://wiki.github.com/klacke/yaws/root-appmod

klacke commented 15 years ago

Well - you can't have both. Either an appmod is responsible for all data below /xxx or it isn't.

Steve Vinoski suggested:

Isn't the answer to issue #5 to just have a "for everything else" out/1 function in the appmod that just does a {page, ...} to tell Yaws to send the file instead?

And - I think this will work fine.

ngocdaothanh commented 15 years ago

Either an appmod is responsible for all data below /xxx or it isn't.

I mean: (1) if the path is /xxx/yyy/zzz, Yaws should pass the request to the appmod, (2) if the path is exactly /xxx, Yaws should serve the static file.

Currently, when running on Yaws the Nitrogen web framework (http://nitrogenproject.com/) must use the path /web/yyy/zzz for all dynamic contents. And the /web prefix is ugly.

Regards.

klacke commented 15 years ago

Ok,

Have you tried the {page, Page} suggestion for the top level page ?

ngocdaothanh commented 15 years ago

{page, Page} works: http://groups.google.com/group/nitrogenweb/browse_thread/thread/c2ce70f696b77c9e

Thanks a lot.

vinoski commented 15 years ago

Since {page, Page} works as expected, closing this issue.

klacke commented 15 years ago

OTOH, - and I've my self come across the very same issue discussed in the google group mentioned above. One possible - and light weight solution could be to assign an exception list to an appmod. That way it would be possible to have an appmod for / but let everything under e.g. /static be directly served by yaws.

?

vinoski commented 15 years ago

I think that's a good idea.