{"id":13500437,"url":"https://github.com/GoogleChromeLabs/simplehttp2server","last_synced_at":"2025-03-29T07:30:52.766Z","repository":{"id":57502474,"uuid":"44676949","full_name":"GoogleChromeLabs/simplehttp2server","owner":"GoogleChromeLabs","description":"A simple HTTP/2 server for development","archived":false,"fork":false,"pushed_at":"2023-12-31T11:53:37.000Z","size":376,"stargazers_count":1735,"open_issues_count":6,"forks_count":98,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-03-17T18:52:02.608Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoogleChromeLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-21T13:09:10.000Z","updated_at":"2025-03-17T14:32:00.000Z","dependencies_parsed_at":"2024-09-30T19:00:23.073Z","dependency_job_id":null,"html_url":"https://github.com/GoogleChromeLabs/simplehttp2server","commit_stats":{"total_commits":62,"total_committers":10,"mean_commits":6.2,"dds":"0.22580645161290325","last_synced_commit":"81e8e1074d89d15b32f27a24660643bd2abbf075"},"previous_names":["googlechrome/simplehttp2server"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fsimplehttp2server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fsimplehttp2server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fsimplehttp2server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleChromeLabs%2Fsimplehttp2server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoogleChromeLabs","download_url":"https://codeload.github.com/GoogleChromeLabs/simplehttp2server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245343998,"owners_count":20599867,"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":[],"created_at":"2024-07-31T22:01:01.064Z","updated_at":"2025-03-29T07:30:52.454Z","avatar_url":"https://github.com/GoogleChromeLabs.png","language":"Go","readme":"`simplehttp2server` serves the current directory on an HTTP/2.0 capable server. This server is for development purposes only. `simplehttp2server` takes a JSON config that allows you to configure headers, redirects and URL rewrites in a lightweight JSON format.\n\nThe format is partially compatible with [Firebase’s JSON config]. Please see [disclaimer](#firebase-disclaimer) below.\n\n# Installation\n## Binaries\n`simplehttp2server` is `go get`-able:\n\n```\n$ go get github.com/GoogleChrome/simplehttp2server\n```\n\nPrecompiled binaries can be found in the [release section](https://github.com/GoogleChrome/simplehttp2server/releases).\n\n## Brew\nYou can also install `simplehttp2server` using brew if you are on macOS:\n\n```\n$ brew tap GoogleChrome/simplehttp2server https://github.com/GoogleChrome/simplehttp2server\n$ brew install simplehttp2server\n```\n\n## Docker\nIf you have Docker set up, you can serve the current directory via `simplehttp2server` using the following command:\n\n```\n$ docker run -p 5000:5000 -v $PWD:/data surma/simplehttp2server [-config firebase.json]\n```\n\n# Usage\n\nRun the `simplehttp2server` command from the directory you want to serve and go to https://localhost:5000 \n\n```\nsimplehttp2server [options]\noptions: \n  -config     string     Config file\n  -cors       string     Set allowed origins (default \"*\")\n  -listen     string     Port to listen on (default \":5000\")\n```\n## That browser warning\n\nWhen you navigate to the server’s address (most likely `https://localhost:5000`), you will probably get a warning about the connection being insecure similar to the following:\n\n![Chrome warning about an insecure certificate](https://raw.githubusercontent.com/GoogleChrome/simplehttp2server/master/warning.png)\n\nThis is __normal__ and correct, since the certificate generated by simplehttp2server is self-signed and doesn’t carry the signature of any common certificate authority (CA). All browsers offer a way to temporarily ignore this error and proceed. This is safe to do.\n\nWhen using Chrome you can enable the [allow-insecure-localhost flag](http://peter.sh/experiments/chromium-command-line-switches/#allow-insecure-localhost) on chrome://flags which disableѕ the certificate warning for localhost. **This flag is required if you want to use ServiceWorkers on https://localhost with a self-signed certificate you haven't explicitly \"trusted\".**\n\n# Config\n\n`simplehttp2server` can be configured with the `-config` flag and a JSON config file. This way you can add custom headers, rewrite rules and redirects. It is partially compatible with [Firebase’s JSON config].\n\nAll `source` fields take the [Extglob] syntax.\n\n## Redirects\n\n```js\n{\n  \"redirects\": [\n    {\n      \"source\": \"/shortlinks/a\",\n      \"destination\": \"https://google.com\",\n      \"type\": 301\n    }\n  ]\n}\n```\n\n## Rewrites\n\nRewrites are useful for SPAs, where all paths return `index.html` and the routing is taking care of in the app itself. Rewrites are only applied when the original target file does not exist.\n\n```js\n{\n  \"rewrites\": [\n    {\n      \"source\": \"/app/**\",\n      \"destination\": \"/index.html\"\n    }\n  ]\n}\n```\n\n## Headers\n\n```js\n{\n  \"headers\": [\n    {\n      \"source\": \"/**.html\",\n      \"headers\": [\n        {\n          \"key\": \"Cache-Control\",\n          \"value\": \"max-age=3600\"\n        }\n      ]\n    },\n    {\n      \"source\": \"/index.html\",\n      \"headers\": [\n        {\n          \"key\": \"Cache-Control\",\n          \"value\": \"no-cache\"\n        },\n        {\n          \"key\": \"Link\",\n          \"value\": \"\u003c/header.jpg\u003e; rel=preload; as=image, \u003c/app.js\u003e; rel=preload; as=script\"\n        }\n      ]\n    }\n  ]\n}\n```\n\nFor details see the [Firebase’s documentation][Firebase’s JSON config].\n\n## Firebase Disclaimer\n\nI haven’t tested if the behavior of `simplehttp2server` _always_ matches the live server of Firebase, and some options (like `trailingSlash` and `cleanUrls`) are completely missing. Please open an issue if you find a discrepancy! The support is not offically endorsed by Firebase (yet 😜), so don’t rely on it!\n\n## HTTP/2 PUSH\n\nAny `Link` headers with `rel=preload` will be translated to a HTTP/2 PUSH, [as is common practice on static hosting platforms and CDNs](https://w3c.github.io/preload/#server-push-http-2). See the [example](#headers) above.\n\n# License\n\nApache 2.\n\n[Extglob]: https://www.npmjs.com/package/extglob\n[Firebase’s JSON config]: https://firebase.google.com/docs/hosting/full-config\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGoogleChromeLabs%2Fsimplehttp2server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGoogleChromeLabs%2Fsimplehttp2server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGoogleChromeLabs%2Fsimplehttp2server/lists"}