http-party / http-server Goto Github PK
View Code? Open in Web Editor NEWa simple zero-configuration command-line http server
License: MIT License
a simple zero-configuration command-line http server
License: MIT License
I'm developing locally and need multiple servers running on different ports, so XHR doesn't work (different port is also blocked by same-origin policy).
I want to simply add Access-Control-Allow-Origin: *
to the response header but other users might have different needs so I'm thinking on a new option to set the custom headers:
http-server --header 'Access-Control-Allow-Origin: *; X-Foo: Bar; X-Lorem: Ipsum; ...'
and also and alias for Access-Control-Allow-Origin: *
:
http-server --cors
If you agree I can implement this feature and ask for a pull request next week.
How I can open a .shtml file?
I use http-server
for local development and love it. Just wondering if there are any plans to have it automatically reserve files in which a change is detected. Not a major issue, just a question/enhancement request.
We should replace the current argument parsing with optimist
and replace it with nconf
.
This will allow http-server
to be configured via the command line, or a config.json
file, or any other transport nconf
supports.
I use http-server to develop multiple projects on my local machine. I want each project to be launched from a different port - so that I can use Chrome DevTools' Workspaces for editing with no problems (DevTools does "per hostname" binding between remote files and local files).
Currently http-server does not allow to load configuration options from a file so I need to manually provide and remember each port for each of my projects.
My proposition is to have a .httpserverrc file (like .bowerrc or .jshintrc) which will allow to store the configuration in a JSON format.
Related issue: #24
There are some issues when trying to use the global install.
module.js:340
throw err;
^
Error: Cannot find module '/Users/vcao/bin/http-server'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
When i uploading some files through http i got the below error.
Error: 3316:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number:openssl\ssl\s3_pkt.c:337:
Please let me know why this issue occurred and how to resolve?
Hey guys,
I got an issue with my http-server. I am using Ubuntu OS, I install http-server via sudo npm install http-server -g.
I have installed successful but when I run 'http-server' command, it didn't work, like this:
noiz@Noiz:$ http-server$
noiz@Noiz:
I dont know why? Help me please.
Thanks,
Heyo , will http-server support SSI in the future, look forward to it thanks。
Would it be possible to have an option for gzip/deflate compression?
Any plans to add support for rewriting urls (like apache mod_rewrite)? I'd like to be able to include links in my source like /link/to/example
instead of /link/to/example.html
Is there an example of using this inside of node, where I can write other code, like mongo or websockets?
Like
server=require (http-server).
server.server(directory)
?
The place to add this to the vendored node-static is probably somewhere in here:
<https://github.com/nodejitsu/http-server/blob/master/vendor/node-static/lib/node-static.js#L66>
Alternately, modifying the finish function itself (wherever it is) may also work.
Is it possible to disable autoIndexing?
> http-server -h
...
-i Display autoIndex [true]
> http-server -i false # does not work
Am I passing -i the wrong value?
Doesn't work on linux mint 17 (based on Ubuntu 14.04)
Does it index directories without a restart of the app? Does marking it False
mean that modifying a directory will not be recognized without a restart of the app? Please explain. Thanks!
Hi,
I'm having trouble fetching the latest version of the npm package.
npm is throwing errors because
https://registry.npmjs.org/http-server/-/http-server-0.6.1.tgz
is not found.
I'm ok downloading the previous version:
https://registry.npmjs.org/http-server/-/http-server-0.6.0.tgz.
An NPM issue? or something wrong with the publish...
I'm not sure what's going on. I tried reinstalling http-server, but it still isn't working. When I run http-server, it says
Starting up http-server, serving ./ on port: 8080 Hit CTRL-C to stop the server
But if I go to http://localhost:8080/, I get a "No Data Received" error in Chrome.
When I installed and reinstalled http-server, I got this error.
https://github.com/indexzero/node-portfinder
This way, http-server
command will "just work" when spawning up multiple instances without having to think about available ports
I always recommend http-server for designers etc... it's very easy to use on any folder.
But a friend on Windows 7 64bits can't use it and I don't know why, the server start fine (but using https on 0.7.0 and http in 0.7.1) but we can't navigate in the browser, the browser just show that the page can't be loaded.
I don't know if there's some debug file in somewhere in windows, if it exist I can check it out and share here for debug.
I downgraded to version 0.6.1 and everything worked fine!
Currently http-server allows you to configure the "cache-control: max-age" value for all urls. But often you want a short max-age for e.g. /{index.html} and a long max-age for urls to versioned assets like /styles/f35ac111.main.css.
Would you accept a patch to allow specifying different max-ages for different urls? (This could be implemented most generally by matching the request url against one or more configurable regexes which map to corresponding max-ages, for instance. But if it's simpler, just giving the long cache time to everything that isn't in the root directory, or every asset with a name like a1b2c3d4.filename.ext would probably work for many use cases.)
I was using Python's SimpleHTTPServer before, and I got some output when the server was running:
python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
1.0.0.127.in-addr.arpa - - [16/Mar/2013 17:57:02] "GET / HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [16/Mar/2013 17:57:02] "GET /js/libs/backbone/backbone.js HTTP/1.1" 200 -
It would be great to see some basics 200, 404, ... in the console. Is this planned? Thanks!
e.g. http://localhost:8080/some%20file.html doesn't seem to find the requested file "some file.html"
Any way to make this work with [backbone's] pushState? IE:
http://localhost:8000/noun/:id
should be interchangable with
http://localhost:8000#noun/:id
Going to try to use http-server for production static site. Would be nice if there was some docs on how to use monit or forever to keep this service up. Any hints or tips for some sort of monitoring would be really helpful for me!!! Thanks Awesome project.
npm home http-server
take you to the 404ing http://nodeapps.github.com/http-server.
it would be really nice to have watch and reload option for http-server
, i use this package all the time and what bugs me is i have to refresh broiwer after making changes all the time.
I wish this had -w watch option which would watch current directory and reload after changes are detected , i know this can be done with other plugins but i wish http-server server had this funtionality.
Thanks
Then you can get rid of this:
require.paths.unshift(require('path').join(__dirname, '..', 'vendor'));
Is there a way using this to get a list of the files in a directory? I have a folder of images and I'd like the server to tell the client app what they are. Only thing I've thought of is making an ajax request to the folder's directory listing page and parsing them out, but that seems less than ideal....
Could someone please explain how to launch this using the "forever" script on Windows. Normally one would type "forever start script.js [script options]" but I'm having trouble finding the actual script. I installed it using the "-g" global switch on npm and it runs fine from the command line by just typing "http-server" but I can't get it to work with "forever".
How can I use angularjs' html5Mode true.
Need to do some server configuration. What needs to be done? Where?
bug:
var uri = [ssl ? 'http' : 'https', '://', host, ':', port].join('');
fix:
var uri = [ssl ? 'https' : 'http', '://', host, ':', port].join('');
Every time I run http-server, the second thing I do is open another terminal tab and type ifconfig -a, and find the IP address I'll use to connect to from other (usually mobile) devices. It would be convenient if http-server offered me that info automatically, if that's even possible w node.
It'd be nice if it'd be a CLI option, and if it'd auto-generate a self-signed cert. Some things need https.
I once served a static file system locally on port 2002 using -p
Now I've killed the server and navigated to a different port. However, it's still serving from the same old directory if I try to use that port.
add mime type support to enable streaming of video files with html 5 video tag
Ordinarily I'd investigate this but I don't have time. If this is not supposed to be a feature then kindly close the issue.
$ aria2c -x 4 --http-proxy="http://127.0.0.1:8080/" http://server:8000/big-image.dmg
# Note the previous ~16% was from another server, aria2c is auto-continuing
[#4bd02b 64MiB/378MiB(16%) CN:4 DL:0B]
03/12 14:12:31 [ERROR] CUID#8 - Download aborted. URI=http://server:8000/big-image.dmg
Exception: [AbstractCommand.cc:315] errorCode=8 URI=http://server:8000/big-image.dmg
-> [HttpResponse.cc:110] errorCode=8 Invalid range header. Request: 232783872-315621375/396531151, Response: 0-396531150/396531151
ecstatic is on 0.4.x, this requires 0.1.x. Seems bad.
My particular use case is getting rid of warnings in my Chrome console about the wrong mime types for fonts ( = development friction), which will require broofa/mime#63 then jfhbrook/node-ecstatic#70 then this issue. Whee...
I jsut did a npm update -g
and http-server command doesn't work anymore.
I have node 10.28 x86 on a windows 7 64 bit machine .
C:\Users\Ovidiu\AppData\Roaming\npm\node_modules\http-server\bin\http-server:43
if (err) throw err;
^
Error: listen EACCES
at errnoException (net.js:904:11)
at Server._listen2 (net.js:1023:19)
at listen (net.js:1064:10)
at net.js:1146:9
at dns.js:72:18
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
can someon else also reproduce this issue ?
It would be nice if we could specify --user
and --pass
to require basic authentication for the server. Obviously this shouldn't be considered secure, but it would be a nice feature for basic protection.
We should find a way to work around this in haibu-carapace
, but right now a simple static site is broken on [email protected]
:
e.g.: http://github.com/indexzero/presentations/tree/master/couchconf-nyc-2011
{
"name": "couchconf-nyc-2011",
"version": "0.0.0-3",
"author": "some-guy",
"subdomain": "couchconf-nyc-2011",
"analyze": "false",
"dependencies": {
"http-server": "0.4.x"
},
"scripts": {
"start": "node_modules/.bin/http-server"
}
}
Would be nice if there was an option to auto-append a trailing /
to the URL (i.e. redirect to the URL with /
appended) in the case of directories where http-server
has loaded index.html
.
Apache and some other web servers do that, and sometimes folks will write their .html
files with the expectation that a sever will perform such redirects.
I'm not able to start the server. I keep hitting the following error.
http-server -p 9999
/usr/local/lib/node_modules/http-server/bin/http-server:21
" -o Open browser window after staring the server",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Unexpected string
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
Please help me with this.
I was hit by the http-server 0.6.0 error so I wanted to update it but I can't. I get the following output in the terminal:
$ npm -g update http-server
info trying registry request attempt 1 at 19:45:53
http GET https://registry.npmjs.org/http-server/latest
http 304 https://registry.npmjs.org/http-server/latest
info trying registry request attempt 1 at 19:45:55
http GET https://registry.npmjs.org/http-server
http 304 https://registry.npmjs.org/http-server
npm http GET https://registry.npmjs.org/http-server/-/http-server-0.6.1.tgz
npm http 404 https://registry.npmjs.org/http-server/-/http-server-0.6.1.tgz
npm ERR! fetch failed https://registry.npmjs.org/http-server/-/http-server-0.6.1.tgz
Indeed, the URL https://registry.npmjs.org/http-server/-/http-server-0.6.1.tgz returns:
{
"error":"not_found",
"reason":"Document is missing attachment"
}
The URL for the previous version, https://registry.npmjs.org/http-server/-/http-server-0.6.0.tgz, works, but this version has a critical issue making it not run.
Would you accept a pull request to accept an --hsts command line flag, which would implement this logic (from https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security ):
protected void Application_BeginRequest(Object sender, EventArgs e)
{
switch (Request.Url.Scheme)
{
case "https":
Response.AddHeader("Strict-Transport-Security", "max-age=31536000");
break;
case "http":
var path = "https://" + Request.Url.Host + Request.Url.PathAndQuery;
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", path);
break;
}
}
It'll make it compatible with dnode.
Assigning to myself (@mmalecki, so that I don't forget).
According to http://www.w3.org/TR/WD-html40-970917/htmlweb.html#h-5.1.3 a relative URL should resolve to the current directory. However it seems the server ignores the current directory and appends directly to the domain. This is problematic for relative links in html.
For example:
on http://domain/page/index.html
<a href='text.html'>
should resolve to http://domain/page/test.html. However currently it resolves to http://domain/test.html.
Investigation shows that this works properly with just union and ecstatic.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.