Skip to content

Conversation

ccaraman
Copy link
Contributor

Description:

  • Allow for redirect actions to specify which response code to use. Ex: some routes want to return a 302 instead of the default 301.
  • Update documentation around TLS redirect response code to reflect code behavior.

Signed-off-by: Constance Caramanolis <ccaramanolis@lyft.com>
Signed-off-by: Constance Caramanolis <ccaramanolis@lyft.com>
Signed-off-by: Constance Caramanolis <ccaramanolis@lyft.com>
api/rds.proto Outdated
}
// The HTTP status code to use in the redirect response. The default response
// code is MOVED_PERMANENTLY (301).
HTTPResponseCode response_code = 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC proto will default this to 0, not 301. @htuch would this be covered by the validator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are complaining about the enum needing to start at 0. api/rds.proto: The first enum value must be zero in proto3. I'll change the enums to start at 0.

Signed-off-by: Constance Caramanolis <ccaramanolis@lyft.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's wait till tomorrow to see if anyone else has any comments.

api/rds.proto Outdated
// Moved Permanently HTTP Status Code - 301.
MOVED_PERMANENTLY = 0;
// Found HTTP Status Code - 302.
FOUND = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be add 304 as well? From this (https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection), 304 seems to be the one that might be useful in future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 303 and 304 to keep the Status codes in order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 303 and 304 to keep the order.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

304 Not Modified definitely shouldn't be one this list, could you please remove it?

On the other hand, 307 Temporary Redirect and 308 Permanent Redirect are definitely worth adding.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes good catch, I missed this. @ccaraman please fix.

@@ -461,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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Copy link
Member

@rshriram rshriram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add 304 to list of options if possible.

api/rds.proto Outdated
string path_redirect = 2;

enum HTTPResponseCode {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the perspective of documentation generation, this is going to appear a bit confusing on the webpage. Suggest renaming to RedirectResponseCode or something to that effect, so as to disambiguate.

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after @rshriram comment.

Signed-off-by: Constance Caramanolis <ccaramanolis@lyft.com>
@ccaraman ccaraman merged commit cd01e0f into master Nov 1, 2017
@mattklein123 mattklein123 deleted the rds-redirect-code branch November 23, 2017 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants