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

Handle termination HTTP signal #78

Merged
merged 2 commits into from
Oct 11, 2020
Merged

Conversation

amcintosh
Copy link
Contributor

Provide a method of remotely terminating the proxy.

See Issue #77

Provide a method of remotely terminating the proxy.

See Issue abutaha#77
Probably don't want to add the ability to remotely shutdown the proxy to
be accessible unless desired and in a safe environment, so moving behind
a flag.

Also updated the README with latest usage.

See Issue abutaha#77
@abutaha
Copy link
Owner

abutaha commented Aug 7, 2020

Hi,

Cool feature! Will have it merged soon.

Thanks,

@amcintosh
Copy link
Contributor Author

Thanks!

@@ -24,4 +24,5 @@ https://github.com/diranged
https://github.com/em0ney
https://github.com/zqben402
https://github.com/dlackty
https://github.com/amcintosh

Choose a reason for hiding this comment

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

😻

@@ -210,6 +212,10 @@ func (p *proxy) getSigner() *v4.Signer {
}

func (p *proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if p.remoteTerminate && r.URL.Path == "/terminate-proxy" && r.Method == http.MethodPost {
logrus.Infoln("Terminate Signal")
os.Exit(0)

Choose a reason for hiding this comment

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

Amazing! ❤️

@@ -210,6 +212,10 @@ func (p *proxy) getSigner() *v4.Signer {
}

func (p *proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if p.remoteTerminate && r.URL.Path == "/terminate-proxy" && r.Method == http.MethodPost {

Choose a reason for hiding this comment

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

How did you land on using POST?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't want to terminate on a GET and while I considered DELETE, this isn't exactly restful, so I figured POST to be the most intuitive.

@amcintosh
Copy link
Contributor Author

Hi @abutaha. Do you know when you'll be able to merge this? Thanks!

@amcintosh amcintosh closed this Oct 1, 2020
@amcintosh amcintosh reopened this Oct 1, 2020
Copy link

@phntom phntom left a comment

Choose a reason for hiding this comment

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

i would like this change merged. @amcintosh do you have a docker hub fork of this built?

@amcintosh
Copy link
Contributor Author

@phntom I do not at the moment.

@abutaha
Copy link
Owner

abutaha commented Oct 6, 2020 via email

@phntom
Copy link

phntom commented Oct 6, 2020

i've deployed your branch under phntom/aws-es-proxy:0.9.1 but i'll switch when an official release is available, seems to be working well with python requests.post to the url.

@abutaha abutaha merged commit 5702d5a into abutaha:master Oct 11, 2020
@amcintosh amcintosh deleted the post-to-terminate branch October 15, 2020 21:42
@enver
Copy link

enver commented Jan 28, 2021

@abutaha Any chance you get this released?

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