0

In a directory containing an index.html I type python -m http.server 8085 and get:

Serving HTTP on 0.0.0.0 port 8085 (http://0.0.0.0:8085/) ...
127.0.0.1 - - [29/May/2018 08:56:40] code 404, message File not found
127.0.0.1 - - [29/May/2018 08:56:40] "GET /dist/css/bootstrap.min.css HTTP/1.1" 404 -
127.0.0.1 - - [29/May/2018 08:56:40] code 404, message File not found
127.0.0.1 - - [29/May/2018 08:56:40] "GET /assets/js/vendor/popper.min.js HTTP/1.1" 404 -

but inside the index.htmlthe importing lines are

<link href="../../../../dist/css/bootstrap.min.css" rel="stylesheet">
<script src="../../../../assets/js/vendor/popper.min.js"></script>

Those paths are correct relative to that directory, if I apply linux lsto the paths between the quotes from there, it finds them.

Inside the console of the browser, it is complaining similarly:

Loading failed for the <script> with source “http://0.0.0.0:8085/assets/js/vendor/popper.min.js”.
0.0.0.0:8085:131

Yes, 131 is the line with that import statement, but why is it ignoring the path in there?

5
  • 1
    Seems you want to access a directory level higher than your initialized root level? Commented May 29, 2018 at 7:26
  • Thanks. What do you mean by "initialized root level"? I would think that "../../../../" is lower than "." but maybe have missed something. How can this be fixed? Commented May 29, 2018 at 7:39
  • 1
    http.server cannot access the directory level higher than current one. Otherwise their will be a huge security problem as people can use http://host/relative/path to get every files on your computer. Do you think that is possible? Commented May 29, 2018 at 7:41
  • Why do you think it will be lower than "."? ".." means parent directory. Commented May 29, 2018 at 7:43
  • Okay @Sraw thanks, have clarified what higher and lower mean, parents, grandparents etc are higher, child directory is lower. Have worried about that security risk before, so good to know why it won't do it. Have changed to a higher directory and tried to run it with this script but there are still path issues, but for further testing will probably just move those libraries into a lower rather than higher directory. Commented May 29, 2018 at 8:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.