Closed micsun-al closed 7 years ago
which directory are you running ws
from? the web_page
folder?
I am running ws from the parent of "web_page".
There are multiple pages I'm testing and "web_page" is one of them.
if you running this command from the parent of "web_page", it will look for the file "index.html" in the same directory.. ws
serves the directory it is run from ..
@75lb I think the default behaviour of the common static spa server is looking for nearest parent index.html
of the url first. Which means with --spa
command, it should serve localhost:8000/web_page/iframe
with "localhost:8000/web_page/iframe/index.html"
Actually for full step, with this author's setup. given that the request is localhost:8000/web_page/iframe
web_page/iframe
, if there is then serve as isweb_page/iframe/
2.1. If there is, redirect to web_page/iframe/
(add the trailing /
for folder)web_page/iframe/index.html
then serve that fileweb_page/index.html
then serve that fileindex.html
then serve that fileCould we have this behaviour instead?
the syntax is --spa <filename>
, e.g. --spa src/iframe/index.html
..
you specify which html file should be served as the SPA.. does that solve your issue?
On Thu, 10 Feb 2022, 04:26 Thaina Yu, @.***> wrote:
@75lb https://github.com/75lb I think the default behaviour of the common static spa server is looking for nearest parent index.html of the url first. Which means with --spa command, it should serve localhost:8000/web_page/iframe with "localhost:8000/web_page/iframe/index.html"
Actually for full step, with this author's setup. given that the request is localhost:8000/web_page/iframe
- It should look for file web_page/iframe, if there is then serve as is
- If missing it should check if there is any folder web_page/iframe/ 2.1. If there is, redirect to web_page/iframe/ (add the trailing / for folder)
- If there is web_page/iframe/index.html then serve that file
- If there is web_page/index.html then serve that file
- If there is index.html then serve that file
Could we have this behaviour instead?
— Reply to this email directly, view it on GitHub https://github.com/lwsjs/local-web-server/issues/54#issuecomment-1034480348, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJQV3HU7ARHYMYK5AYGJ53U2M457ANCNFSM4CUPDLWQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
you specify which html file should be served as the SPA.. does that solve your issue?
It's not. Because then when I go to localhost:8000
it then still try to serve src/iframe/index.html
instead of src/index.html
As I said, common spa static server, firebase for example, will always recursively look for the spa
file of the parents recursively. This behaviour let we host multiple app in each subdirectory
you can modify the spa behaviour to work in any way you like - it's just a plugin which you can fork and tweak.. see the wiki for an explanation of plugins, I'll get back to you with an example showing how to modify --spa later
On Thu, 10 Feb 2022, 05:27 Thaina Yu, @.***> wrote:
you specify which html file should be served as the SPA.. does that solve your issue?
It's not. Because then when I go to localhost:8000 it then still try to serve src/iframe/index.html instead of src/index.html
As I said, common spa static server, firebase for example, will always recursively look for the spa file of the parents recursively. This behaviour let we host multiple app in each subdirectory
— Reply to this email directly, view it on GitHub https://github.com/lwsjs/local-web-server/issues/54#issuecomment-1034507829, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJQV3C5CGQK6IEWAMRZOA3U2NEFXANCNFSM4CUPDLWQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
Thank you for your explanation. Still I would like to beg for you to consider this behaviour as default of the plugin so that it not confused and could be loaded from npm
yes, that's a possibility too..
On Thu, 10 Feb 2022, 06:04 Thaina Yu, @.***> wrote:
Thank you for your explanation. Still I would like to beg for you to consider this behaviour as default of the plugin so that it not confused and could be loaded from npm
— Reply to this email directly, view it on GitHub https://github.com/lwsjs/local-web-server/issues/54#issuecomment-1034530296, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJQV3HXM4EVHMGZ4WEBLALU2NIPBANCNFSM4CUPDLWQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
The set up is like the following:
The HTML is:
<iframe src="iframe"></iframe>
I start the server using the following command line:
ws --spa index.html
The error I get is:
GET http://localhost:8000/iframe 404 (Not Found)
I think the expected behavior is for the relative path of the iframe src value of "iframe" to look in the subdirectory "localhost:8000/web_page/iframe" and use the spa of "index.html" as well as all the contents inside the iframe should have the relative path of the src value.
This does not seem to work with the following iframe src values:
This does seem to work with the following iframe src values:
The following partially works, but the relative path of the elements in the iframe seem to look in the parent directory, "localhost:8000/web_page", instead of "localhost:8000/web_page/iframe" (tries to serve "localhost:8000/web_page/scripts/some_script.js" instead of "localhost:8000/web_page/iframe/scripts/some_script.js").
(Sorry if I'm doing something dumb!)