{"id":18636264,"url":"https://github.com/slavaganzin/http2-server","last_synced_at":"2025-04-11T08:31:09.435Z","repository":{"id":57160841,"uuid":"68921929","full_name":"slavaGanzin/http2-server","owner":"slavaGanzin","description":"Simple HTTP2/SPDY server similiar to http-server using express \u0026 node-spdy","archived":false,"fork":false,"pushed_at":"2020-09-22T12:41:31.000Z","size":109,"stargazers_count":21,"open_issues_count":1,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-09T05:48:25.132Z","etag":null,"topics":["http2","http2-push","nodejs","server"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slavaGanzin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-22T13:04:33.000Z","updated_at":"2023-08-25T07:36:52.000Z","dependencies_parsed_at":"2022-08-24T12:20:18.526Z","dependency_job_id":null,"html_url":"https://github.com/slavaGanzin/http2-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavaGanzin%2Fhttp2-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavaGanzin%2Fhttp2-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavaGanzin%2Fhttp2-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavaGanzin%2Fhttp2-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slavaGanzin","download_url":"https://codeload.github.com/slavaGanzin/http2-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248361504,"owners_count":21090914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http2","http2-push","nodejs","server"],"created_at":"2024-11-07T05:28:54.226Z","updated_at":"2025-04-11T08:31:09.113Z","avatar_url":"https://github.com/slavaGanzin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"*Stop bundling your css/js and enjoy [HTTP2](https://http2.github.io/) and [PUSH_PROMISE](http://httpwg.org/specs/rfc7540.html#PUSH_PROMISE)*\n\n[![npm version](https://badge.fury.io/js/static-http2-server.svg)](https://badge.fury.io/js/static-http2-server)\n[![Build Status](https://travis-ci.org/slavaGanzin/http2-server.svg?branch=master)](https://travis-ci.org/slavaGanzin/http2-server)\n\u003c!-- [![](https://david-dm.org/slavaGanzin/http2-server.svg)](https://david-dm.org/slavaGanzin/http2-server) --\u003e\n\n# http2-server\nSimple HTTP2/SPDY server similiar to [http-server](https://github.com/indexzero/http-server) using [express](https://github.com/expressjs/express) \u0026 [node-spdy](https://github.com/indutny/node-spdy)\n\n*Due to issues in [node-spdy](https://github.com/spdy-http2/node-spdy/issues/363) http2-server will not work on Node 12 or above. If someone want to fix this we all will appreciate your work*\n\n# Installation\n```\n  sudo npm install -g static-http2-server\n```\n# Naive PUSH_PROMISE\nBy default http2-server match static resources with their Referer header (for example '/') and will [server push](https://http2.github.io/faq/#whats-the-benefit-of-server-push) them coupled with response, when refered resource (e.g. index.html) would be requested next time\n\n\n\n# Usage\n\n```\n\nhttp2-server [path] [options]\n\n  Options:\n\n    -h, --help                        output usage information\n    -V, --version                     output the version number\n    -a, --address [127.0.0.1]         address to use\n    -p, --ssl-port [4443]             ssl port to use\n    --http-port [8080]                http port which redirects to ssl port\n    -c, --cache                       enable cache\n    -m, --maxAge [0]                  cache maxAge in ms acceptable string\n        https://github.com/zeit/ms\n\n    -P, --no-push                     disable naive PUSH_PROMISE\n    -o, --open [xdg-open]             open default app after starting the server\n        -o firefox\n        -o \"google-chrome --incognito\"\n        -o \"curl --insecure\"\n\n    -l, --log [dev]                   log format (dev|combined|common|short|tiny)\n        https://github.com/expressjs/morgan#predefined-formats\n\n    -s, --silent                      suppress log messages from output\n    --cors                            enable CORS\n    -S, --no-ssl                      disable https\n          Works as plain http server without http2, spdy, push_promise\n\n    -e, --cert [certs/cert.pem]       path to ssl cert file\n    -k, --key  [certs/key.pem]        path to ssl key file\n    --generate-cert                   save autogenerated certificates and exit\n    --trust-cert                      add certificate to trusted (currently linux only)\n    -g, --compression                 enable deflate/gzip/brotli/zopfli\n    -i, --index [index.html]          Specify index file name\n    --proxy [https://127.0.0.1:4443]  Proxies all requests which can't be resolved locally to the given url.\n    e.g.: -P http://someurl.com\n    -I, --no-autoindex                Disable auto index\n    --404                             404 error page\n\n\n```\n\n# Usage as a dependency in your project\n\n```\n  npm install static-http2-server --save\n```\n\npackage.json:\n```json\n...\n  \"scripts\": {\n    \"start\": \"node_modules/.bin/http2-server -o\",\n  },\n...\n```\n\n# SSL certificates\nFor development you can use autogenerated selfsigned certificates. For production you should use [Let's encrypt](https://letsencrypt.org/) or any other [certificate authority](https://en.wikipedia.org/wiki/Certificate_authority)\n\n\n#### certutil\nTo generate and/or trust certificate you need [certutil](https://www.google.com/search?q=certutil).\n\n```bash\n#Ubuntu\nsudo apt install libnss3-tools\n\n#Arch\nsudo pacman -S nss\n\n#Mac\nbrew install nss\n```\n\n#### Generate selfsigned certificates and trust them\n\n```bash\n  http2-server --generate-cert --trust-cert\n```\n\n#### Add previously generated certificate to trusted\n```bash\n  http2-server --trust-cert --cert path/to/your.cert\n```\n\n#### See also\n[minica](https://github.com/jsha/minica)\n[letsencrypt-cli](https://github.com/Daplie/letsencrypt-cli)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslavaganzin%2Fhttp2-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslavaganzin%2Fhttp2-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslavaganzin%2Fhttp2-server/lists"}