{"id":15706805,"url":"https://github.com/stephenlb/http2-proxy","last_synced_at":"2025-10-14T19:39:58.194Z","repository":{"id":66632408,"uuid":"157280164","full_name":"stephenlb/http2-proxy","owner":"stephenlb","description":"Docker container with HTTP/2 proxy built in.  Easily add your own backend to test HTTP/2 traffic.","archived":false,"fork":false,"pushed_at":"2019-01-25T21:22:02.000Z","size":35,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T19:39:57.476Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/stephenlb.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-12T21:36:31.000Z","updated_at":"2024-01-13T23:59:08.000Z","dependencies_parsed_at":"2024-03-27T12:15:16.474Z","dependency_job_id":null,"html_url":"https://github.com/stephenlb/http2-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stephenlb/http2-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenlb%2Fhttp2-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenlb%2Fhttp2-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenlb%2Fhttp2-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenlb%2Fhttp2-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephenlb","download_url":"https://codeload.github.com/stephenlb/http2-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenlb%2Fhttp2-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020654,"owners_count":26086898,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-03T20:28:44.157Z","updated_at":"2025-10-14T19:39:58.179Z","avatar_url":"https://github.com/stephenlb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Test HTTP/2 using an Nginx Proxy\n\nDo you want to test HTTP/2 without deploying any code?\nThis is how to test HTTP/2.0 connections from your computer.\nThis proxy will connect HTTP/2.0 then proxy that connection\nto your production or staging web server.\n\nThis is how to run an HTTP/2 proxy that uses HTTP/2 connections to your server.\nThis will guide you on how to do it!\nBy default the `nginx.conf` is setup to proxy to PubNub APIs.\nYou can change this settings to point to your upstream servers.\n\nThe dockerfile comes ready with HTTP/2 Nginx.\nTo change the upstream value, open `nginx.conf` and set the `server`\nto point to your domain.\nRe-run the build step for any changes you make to `nginx.conf`.\nThe domain is currently set to `pubsub.pubnub.com` by default.\nThe examples in this readme will use PubNub URLs for testing purposes.\n\n### Change your Upstream\n\nEasily update the upstream to target your servers.\nOpen `nginx.conf` and edit the line below.\n\n```nginx\n## -----------------------------------------------------------------------\n## Upstreams\n## -----------------------------------------------------------------------\nupstream pubnub_servers {\n    ## Change pubsub.pubnub.com to your-server.com\n    ## server your-server.com:80 max_fails=3;\n    server pubsub.pubnub.com:80 max_fails=3; ## \u003c------- Change this line\n    keepalive 512;\n}\n```\n\n### Build and Run Docker\n\nBuild and run the dockerfile.\nThis will launch an HTTPS server with HTTP/2.0 enabled.\nThe access and error logs will print to STDOUT.\n\n```shell\ndocker build -t http2 .\ndocker run -p 4443:4443 http2\n```\n\nNotice that HTTP/2.0 will show up in the logs if an HTTP/2 client is used.\nAnd HTTP/1.1 will show up for 1.1 client requests.\n\n![how to run an HTTP/2 proxy](https://i.imgur.com/Y20dm7M.png)\n\n### Config DNS\n\nAdd this line into your DNS override file.\n\n\u003e `sudo vi /etc/hosts`\n\n```\n0.0.0.0     pubnubcoin.com\n```\n\n### CURL Test\n\nTest a url with HTTP/2.\nThis example uses a PubNub URL.\n\n\u003e `pubnubcoin.com` resolves to `0.0.0.0` for testing purposes.\n\n```shell\ncurl https://pubnubcoin.com:4443/time/0 -v -k --http2 ## Verbose w/ Headers\ncurl https://pubnubcoin.com:4443/time/0    -k --http2 ## Output Response Only\n```\n\nTest PubNub With HTTP/1.1 Backward Compatible.\n\n```shell\ncurl https://pubnubcoin.com:4443/time/0 -v -k --http1.1 ## Verbose w/ Headers\ncurl https://pubnubcoin.com:4443/time/0    -k --http1.1 ## Output Response Only\n```\n\n### Browser Test\n\nYou need to add an exception for a self-signed certificate.\n\n 1. Go to: https://pubnubcoin.com:4443/time/0\n 2. Add exception to self-signed certificate.\n 3. Go to: https://www.pubnub.com/docs/console?channel=pubnub-twitter\u0026origin=pubnubcoin.com:4443\u0026sub=sub-c-78806dd4-42a6-11e4-aed8-02ee2ddab7fe\n 4. You should see HTTP/2 Traffic and JSON messages from Live Tweets.\n\n### HTTPS Testing via Python\n\nInstall any needed package dependencies.\nFor example `pip install requests` may be needed.\n\n```python\nimport requests\nimport requests.packages.urllib3\nrequests.packages.urllib3.disable_warnings()\n\nresponse = requests.get(\n    'https://pubnubcoin.com:4443/time/0',\n    verify='certs/server.cert'\n)\nprint(response.content)\n```\n\n```shell\npython python-test-request.py\n```\n\n### SDK Test Example\n\nDownload your SDK and set the `origin` host parameter as `pubnubcoin.com:4443`.\nThis will test HTTP(S)/1.1 againts HTTP(S)/2 endpoint.\n\n```javascript\nconst PubNub = require('pubnub')\n\nlet pubnub = new PubNub({\n    ssl          : true,                  // \u003c----------- secure\n    origin       : 'pubnubcoin.com:4443', // \u003c----------- origin\n    publishKey   : 'demo',\n    subscribeKey : 'demo'\n})\n\npubnub.addListener({\n    status: statusEvent =\u003e {\n        if (statusEvent.category === \"PNConnectedCategory\") {\n            publishSampleMessage()\n        }\n    },\n    message: msg =\u003e {\n        console.log(msg.message.title)\n        console.log(msg.message.description)\n    }\n})      \n\nconsole.log(\"Subscribing..\")\npubnub.subscribe({ channels: ['hello_world']  })\n\nfunction publishSampleMessage() {\n    let publishConfig = {\n        channel : \"hello_world\",\n        message : {\n            title: \"greeting\",\n            description: \"hello world!\"\n        }\n    }\n    pubnub.publish( publishConfig, ( status, response ) =\u003e\n        console.log(response)\n    )\n}\n```\n\n### Export/Import Docker Container\n\nTo get this container running on EC2, we can import/export a tarball.\n\n```shell\n## Save/Export\ndocker save http2 \u003e http2.tar\ngzip -9 http2.tar\n\n## Import/Load\ndocker load \u003c http2.tar.gz\n```\n\n### Self Signed Certificate\n\nA Starfield SHA-2 Certificate is included in this repository\nassigned to `pubnubcoin.com`.\nThis allows you to test PubNub HTTP2 without\nCertificate Authority errors.\n\nTo generate a self signed certificate, you can use the following openssl command:\n\n```shell\nopenssl req -new -out server.cert -x509 -days 3650 -keyout server.key -nodes -subj '/CN=0.0.0.0/O=PubNub/C=US/subjectAltName=DNS:localhost'\n```\n\n### IP Tables for Server Host\n\nFor using 443, you'll need to add an iptables rule.\nAllow inbound from 443 routed over 4443.\nYou may use `sudo docker run -p 443:4443 http2` however this is bad practice!\n\n```shell\niptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 4443\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenlb%2Fhttp2-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephenlb%2Fhttp2-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenlb%2Fhttp2-proxy/lists"}