Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Server should handle standby redirects #16

Merged
merged 3 commits into from
Apr 19, 2015
Merged

HTTP Server should handle standby redirects #16

merged 3 commits into from
Apr 19, 2015

Conversation

armon
Copy link
Member

@armon armon commented Apr 19, 2015

This PR changes the HTTP server to generate 307 redirects when in standby mode. 307 is used instead of 302 because 302 causes the HTTP METHOD to switch to GET regardless of the original method.

Outstanding issues:

  • Clients must follow 307 on PUT/DELETE
  • Cookie is scoped to the original host, after the redirect the auth cookie is not provided.

/cc: @mitchellh

@@ -62,8 +63,12 @@ func parseRequest(r *http.Request, out interface{}) error {

// request is a helper to perform a request and properly exit in the
// case of an error.
func request(core *vault.Core, w http.ResponseWriter, r *logical.Request) (*logical.Response, bool) {
func request(core *vault.Core, w http.ResponseWriter, reqURL *url.URL, r *logical.Request) (*logical.Response, bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of doing url.URL lets just pass the full http.Request object through. We don't know when we might need it in the future and it actually makes it easier to call as a client: w, r is pretty esa.

@mitchellh
Copy link
Contributor

One comment but LGTM,good catch.

@armon
Copy link
Member Author

armon commented Apr 19, 2015

@mitchellh Good call. Updated.

armon added a commit that referenced this pull request Apr 19, 2015
HTTP Server should handle standby redirects
@armon armon merged commit 3eaffc7 into master Apr 19, 2015
@armon armon deleted the f-redirect branch April 19, 2015 21:37
@armon
Copy link
Member Author

armon commented Apr 19, 2015

@mitchellh I started the client redirect but ran into some issues. The main one is that the io.Reader gets consumed in the original request. Thoughts?

@mitchellh
Copy link
Contributor

@armon Hm, if it doesn't work, we can always make a special response type that we catch at the API layer and re-send it.

jeffwecan added a commit to jeffwecan/vault that referenced this pull request Nov 7, 2018
…e_subnets

[SRE-2000] Handle Multiple Subnets In VPC Peering Module
briankassouf pushed a commit that referenced this pull request Aug 24, 2020
Bring over PSIRT-37 changes from ENT
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.

2 participants