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

forward request to another api endpoint #571

Closed
zewa666 opened this issue Jan 1, 2022 · 2 comments
Closed

forward request to another api endpoint #571

zewa666 opened this issue Jan 1, 2022 · 2 comments
Labels

Comments

@zewa666
Copy link

zewa666 commented Jan 1, 2022

hey there

i've a somewhat weird use case perhaps. I'm exposing an ipv6 service using a ddns services. Now since GitHub does not allow to enter ipv6 adresses for payload urls I did the following:

  • on a public cloud vps i've installed webhook using ipv4
  • added this target as new payload url in my github webhooks config
  • configured a command which executes a shell script with a curl replicating the github request and forwarding it to my ipv6 service
  • my service now can handle the webhook

while this is total overkill and a simple nginx reverse proxy config could have already solved my trouble it was nevertheless a fun experience to learn more about this app.

so much for the use cases, now the 2 issues I have.
I'm not sure how to exactly mimic the request delegation with curl. do you have an example or is there perhaps already a built in reverse proxy feature? and secondly how can I make the command fail (non 200) if the curl request results in an error?

@zewa666 zewa666 changed the title forward request to another instance forward request to another api endpoint Jan 1, 2022
@moorereason
Copy link
Collaborator

I'm not sure how to exactly mimic the request delegation with curl.

Me either.

is there perhaps already a built in reverse proxy feature?

No, and I'm not aware of any plans to add that.

how can I make the command fail (non 200) if the curl request results in an error?

You have to capture the exit code of the curl command and make sure your script exists with an error. For example, in bash:

curl --foobar
echo $?

@adnanh
Copy link
Owner

adnanh commented Jan 16, 2022

I think a simple SSH tunnel would be much more suitable for that use case, and probably a one-liner too. :-)

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

No branches or pull requests

3 participants