Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Wrong /v1/sys/capabilities-self HTTP method #103

Closed
StyleT opened this issue Apr 25, 2017 · 7 comments · Fixed by #104
Closed

Wrong /v1/sys/capabilities-self HTTP method #103

StyleT opened this issue Apr 25, 2017 · 7 comments · Fixed by #104
Assignees
Labels

Comments

@StyleT
Copy link

StyleT commented Apr 25, 2017

Use POST instead of GET accordingly to the https://www.vaultproject.io/api/system/capabilities-self.html. Vault 0.7.0 returns 405 HTTP code {"errors":["1 error occurred:\n\n* unsupported operation"]}.

@djenriquez djenriquez added the bug label Apr 25, 2017
@djenriquez
Copy link
Owner

Thanks for the catch @StyleT, should be a quick fix.

@djenriquez
Copy link
Owner

@StyleT Vault-UI is using POST and not GET: https://github.com/djenriquez/vault-ui/blob/master/app/components/App/App.jsx#L123 and https://github.com/djenriquez/vault-ui/blob/master/app/components/shared/VaultUtils.jsx#L83 which are the only two places in the entire project this is called, where are you seeing this bug?

@djenriquez djenriquez added question and removed bug labels Apr 26, 2017
@StyleT
Copy link
Author

StyleT commented Apr 26, 2017

@djenriquez I've seen it in OS X app https://github.com/djenriquez/vault-ui/releases/download/2.1.0/Vault-UI-2.1.0-mac.zip Yesterday I've also noticed what you're saying. Let me check...

@StyleT
Copy link
Author

StyleT commented Apr 26, 2017

Here is what I see: http://imgur.com/a/LSzrJ

@StyleT
Copy link
Author

StyleT commented Apr 26, 2017

@djenriquez Looks like I've found the root cause. Try to add slash to the end of the server address. So specify https://vault.example.com/ instead of https://vault.example.com. In this case on your POST request you'll receive 301 redirect (app will request https://vault.example.com//v1/sys....) which causes 2nd GET request.

@msessa
Copy link
Collaborator

msessa commented Apr 26, 2017

Interesting. Thanks for digging out the root cause. I'll take a look at it, one quick solution would be to parse the URL before saving it in the localStorage so all trailing slashes and extra components are stripped away

@StyleT
Copy link
Author

StyleT commented Apr 26, 2017

@msessa Also you can use https://www.npmjs.com/package/url-join to concat URLs. It will take care about slashes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants