From 661bdaabf58e1f8f5131a336e43215eb5f899d4b Mon Sep 17 00:00:00 2001 From: Constance Caramanolis Date: Mon, 30 Oct 2017 14:03:09 -0700 Subject: [PATCH 1/5] redirect: Add HTTP response codes. Signed-off-by: Constance Caramanolis --- api/rds.proto | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/api/rds.proto b/api/rds.proto index 6f85c967e..c3c45fd7b 100644 --- a/api/rds.proto +++ b/api/rds.proto @@ -285,12 +285,19 @@ message RouteAction { } message RedirectAction { - // A 302 redirect response will be sent which swaps the host portion of the - // URL with this value. + // The host portion of the URL will be swapped with this value. string host_redirect = 1; - // A 302 redirect response will be sent which swaps the path portion of the - // URL with this value. + // The path portion of the URL will be swapped with this value. string path_redirect = 2; + + // The HTTP status code to use in the redirect response. + enum HTTPResponseCode { + // Moved Permanently HTTP Status Code - 301. This is the default HTTP Status + // code sent in redirect responses. + MOVED_PERMANENTLY = 0; + // Found HTTP Status Code - 302. + FOUND = 1; + } } message Decorator { From 2b790500b1db20af7285fde204ac668840915b09 Mon Sep 17 00:00:00 2001 From: Constance Caramanolis Date: Mon, 30 Oct 2017 15:35:52 -0700 Subject: [PATCH 2/5] Change values to match code value Signed-off-by: Constance Caramanolis --- api/rds.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/rds.proto b/api/rds.proto index c3c45fd7b..fcb86487d 100644 --- a/api/rds.proto +++ b/api/rds.proto @@ -294,9 +294,9 @@ message RedirectAction { enum HTTPResponseCode { // Moved Permanently HTTP Status Code - 301. This is the default HTTP Status // code sent in redirect responses. - MOVED_PERMANENTLY = 0; + MOVED_PERMANENTLY = 301; // Found HTTP Status Code - 302. - FOUND = 1; + FOUND = 302; } } From 9458f9f6e11d616287e0a3d361bf45ba15572b65 Mon Sep 17 00:00:00 2001 From: Constance Caramanolis Date: Mon, 30 Oct 2017 15:38:52 -0700 Subject: [PATCH 3/5] Fixed comments Signed-off-by: Constance Caramanolis --- api/rds.proto | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/api/rds.proto b/api/rds.proto index fcb86487d..64686a7ea 100644 --- a/api/rds.proto +++ b/api/rds.proto @@ -290,14 +290,15 @@ message RedirectAction { // The path portion of the URL will be swapped with this value. string path_redirect = 2; - // The HTTP status code to use in the redirect response. enum HTTPResponseCode { - // Moved Permanently HTTP Status Code - 301. This is the default HTTP Status - // code sent in redirect responses. + // Moved Permanently HTTP Status Code - 301. MOVED_PERMANENTLY = 301; // Found HTTP Status Code - 302. FOUND = 302; } + // The HTTP status code to use in the redirect response. The default response + // code is MOVED_PERMANENTLY (301). + HTTPResponseCode response_code = 3; } message Decorator { @@ -468,9 +469,9 @@ message VirtualHost { // No TLS requirement for the virtual host. NONE = 0; // External requests must use TLS. If a request is external and it is not - // using TLS, a 302 redirect will be sent telling the client to use HTTPS. + // using TLS, a 301 redirect will be sent telling the client to use HTTPS. EXTERNAL_ONLY = 1; - // All requests must use TLS. If a request is not using TLS, a 302 redirect + // All requests must use TLS. If a request is not using TLS, a 301 redirect // will be sent telling the client to use HTTPS. ALL = 2; } From 05b34233860ea3e93782a90fff13c25d1e1478bd Mon Sep 17 00:00:00 2001 From: Constance Caramanolis Date: Mon, 30 Oct 2017 16:11:01 -0700 Subject: [PATCH 4/5] Make proto3 happy with enums starting at 0. Signed-off-by: Constance Caramanolis --- api/rds.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/rds.proto b/api/rds.proto index 64686a7ea..da738a14b 100644 --- a/api/rds.proto +++ b/api/rds.proto @@ -292,9 +292,9 @@ message RedirectAction { enum HTTPResponseCode { // Moved Permanently HTTP Status Code - 301. - MOVED_PERMANENTLY = 301; + MOVED_PERMANENTLY = 0; // Found HTTP Status Code - 302. - FOUND = 302; + FOUND = 1; } // The HTTP status code to use in the redirect response. The default response // code is MOVED_PERMANENTLY (301). From 3288632dbc4c0f5adf1070877ada2b26db2feb03 Mon Sep 17 00:00:00 2001 From: Constance Caramanolis Date: Wed, 1 Nov 2017 10:47:59 -0700 Subject: [PATCH 5/5] Add 303 and 304 status codes and rename enum class. Signed-off-by: Constance Caramanolis --- api/rds.proto | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api/rds.proto b/api/rds.proto index da738a14b..fab5e2d48 100644 --- a/api/rds.proto +++ b/api/rds.proto @@ -290,15 +290,19 @@ message RedirectAction { // The path portion of the URL will be swapped with this value. string path_redirect = 2; - enum HTTPResponseCode { + enum RedirectResponseCode { // Moved Permanently HTTP Status Code - 301. MOVED_PERMANENTLY = 0; // Found HTTP Status Code - 302. FOUND = 1; + // See Other HTTP Status Code - 303. + SEE_OTHER = 2; + // Not Modified HTTP Status Code - 304. + NOT_MODIFIED = 3; } // The HTTP status code to use in the redirect response. The default response // code is MOVED_PERMANENTLY (301). - HTTPResponseCode response_code = 3; + RedirectResponseCode response_code = 3; } message Decorator {