Git Product home page Git Product logo

cloud-run-http2's Introduction

Cloud Run HTTP/2 Sample Server

This Go application serves requests using only the HTTP/2 cleartext (h2c) protocol (it does not support upgrading from HTTP/1.1).

It is provided for testing end-to-end HTTP/2 capabilities on Cloud Run.

Deploying to Cloud Run

Click this button:

Run on Google Cloud

Alternatively, you can use the gcloud SDK:

gcloud beta run deploy http2-test --use-http2 --source=.

Cleanup: Remove the http2-test Service you deployed from Cloud Run using the Cloud Console.

Testing locally

  1. Check out this repository and navigate to this directory

  2. Start the server locally:

    go run .

Verifying h2c

  1. After the server starts, make a request using curl and use --http2-prior-knowledge to prevent upgrading from HTTP/1.1 (which is intentionally not supported by this program).

    curl -v --http2-prior-knowledge localhost:8080

    Note: If you have deployed on Cloud Run, you can replace localhost:8080 with your Cloud Run service URL.

  2. The curl output should indicate HTTP/2 is used:

    < HTTP/2 200
    < content-type: text/plain; charset=utf-8
    < content-length: 32
    < date: Fri, 08 Jan 2021 18:13:06 GMT
    
    This request is served over HTTP/2.0 protocol!
    

Since this server intentionally doesn't support upgrading from HTTP/1.1, performing the same query without the --http2-prior-knowledge option makes curl to use HTTP/1, which fails as expected.

cloud-run-http2's People

Contributors

ilkerispir avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.