Skip to content

Fix a cryptic error you get if you use the wrong URL for your GitHub Enterprise Server instance. #49

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

Merged
merged 1 commit into from
Jan 11, 2021

Conversation

chrisgavin
Copy link
Collaborator

One user of the tool encountered this cryptic error:

FATA[0117] GET https://github.example.com/api/v3/admin/users/actions-admin/authorizations: 404 Not Found []
Failed to impersonate Actions admin user.

This is error is actually caused by the --destination-url being specified as an HTTP URL instead of an HTTPS URL. The HTTP URL 301 redirects to the HTTPS URL and the client dutifully follows those redirects which is all well-and-good until we try and make a non-GET request, at which point it it gets converted to a GET request and receives a 404 response (arguably a 405 would make more sense).

Ideally GitHub Enterprise Server should be returning a 308 redirect which disallows changing the method after the redirect but my understanding is that this is not supported by all clients and probably difficult to change. Instead the tool can handle this case by updating the URL right at the start if it detects the root of the API redirects.

@chrisgavin chrisgavin force-pushed the fix-cryptic-redirect-error branch from 86cb6f1 to 7ef8d60 Compare December 22, 2020 18:01
@chrisgavin chrisgavin merged commit abe96c5 into main Jan 11, 2021
@chrisgavin chrisgavin deleted the fix-cryptic-redirect-error branch January 11, 2021 21:57
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