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?

cardamom
  • 6,873
  • 11
  • 48
  • 102
  • 1
    Seems you want to access a directory level higher than your initialized root level? – strippenzieher May 29 '18 at 07: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? – cardamom May 29 '18 at 07: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? – Sraw May 29 '18 at 07:41
  • Why do you think it will be lower than "."? ".." means parent directory. – Sraw May 29 '18 at 07: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](https://stackoverflow.com/a/39801780/4288043) but there are still path issues, but for further testing will probably just move those libraries into a _lower_ rather than _higher_ directory. – cardamom May 29 '18 at 08:09

0 Answers0