diff --git a/echoheaders/Makefile b/echoheaders/Makefile index 04098f292..e51fdeea1 100644 --- a/echoheaders/Makefile +++ b/echoheaders/Makefile @@ -1,7 +1,7 @@ all: push # TAG 0.0 shouldn't clobber any release builds -TAG = 1.2 +TAG = 1.3 PREFIX = gcr.io/google_containers/echoserver container: diff --git a/echoheaders/README.md b/echoheaders/README.md index f69e69bcb..b9cc0c54f 100644 --- a/echoheaders/README.md +++ b/echoheaders/README.md @@ -1,3 +1,6 @@ # Echoserver -This is a simple python http server that responds with the http headers it received, runs on port 8080. +This is a simple server that responds with the http headers it received. +Image versions >= 1.3 redirect requests on :80 with `X-Forwarded-Proto: http` to :443. +Image versions > 1.0 run an nginx server, and implement the echoserver using lua in the nginx config. +Image versions <= 1.0 run a python http server instead of nginx, and don't redirect any requests. diff --git a/echoheaders/echo-app.yaml b/echoheaders/echo-app.yaml index a643e3988..c4d357bf9 100644 --- a/echoheaders/echo-app.yaml +++ b/echoheaders/echo-app.yaml @@ -27,6 +27,6 @@ spec: spec: containers: - name: echoheaders - image: gcr.io/google_containers/echoserver:1.2 + image: gcr.io/google_containers/echoserver:1.3 ports: - containerPort: 8080 diff --git a/echoheaders/nginx.conf b/echoheaders/nginx.conf index 7386a1ac0..5ce215a4b 100644 --- a/echoheaders/nginx.conf +++ b/echoheaders/nginx.conf @@ -11,10 +11,16 @@ http { server { # please check the benefits of reuseport https://www.nginx.com/blog/socket-sharding-nginx-release-1-9-1 - # basically instructs to create an individual listening socket for each worker process (using the SO_REUSEPORT + # basically instructs to create an individual listening socket for each worker process (using the SO_REUSEPORT # socket option), allowing a kernel to distribute incoming connections between worker processes. listen 8080 default_server reuseport; + # Replace '_' with your hostname. + server_name _; + if ($http_x_forwarded_proto = "http") { + return 301 https://$host$request_uri; + } + location / { lua_need_request_body on; content_by_lua_block {