lwsjs / local-web-server

A lean, modular web server for rapid full-stack development.
MIT License
1.21k stars 85 forks source link

Files not being served from rewrite rule after setting a SPA and root directory #45

Closed huystuhh closed 8 years ago

huystuhh commented 8 years ago

Hi, I'm having an issue getting a rewrite rule to successfully serve files after setting a new root directory as a SPA. Basically, my folder directory is similar to this:

Essentially, I'm launching the ws from the project root, setting app as the new root directory, setting index.html as the starting point for the SPA flag, and then trying to serve the bower_components folder to the app.

This is my launch command: ws -d app --spa index.html -r '/bower_components/* -> ../bower_components/$1'

I'm getting a 403 error in terminal whenever the server tries to access the files. So I believe it's finding the folder, but can't serve it up. I've tried modifying the folder permissions with no success so far. Is there a way to do this currently? I might just be missing something completely. Any assistance would be greatly appreciated! Thanks!

75lb commented 8 years ago

Hi! Files outside of the root directory will not be served (for security reasons). If you set --directory to /app, then only files inside /app can be served. A rewrite can not help you here.

Your bower_components folder needs to be inside the root folder, so either serve the root project folder or move bower_components into /app