Overwriting a host header in webhooks

I’m trying to find a workaround for a webhook configuration where modifying the host header is not allowed.

Context:

I have a REST API datasource which is using an agent. I am trying to create a webhook which calls a POST endpoint using an IP address, but it requires the host header set to HOST_XXX (where XXX is a number). Since it is not allowed to modify the host header in the webhook configuration, I’m looking for alternative solutions.

What I’ve Tried:

I attempted the following workaround:

  1. Added an entry to /etc/hosts on the agent machine:
   10.xxx.xxx.xx HOST_XXX
  1. Changed the webhook to call HOST_XXX instead of the IP address directly

The idea was that by using the domain name, the host header would automatically be set correctly.

The Problem:

I’m getting an “invalid domain” error with this approach.

Questions:

  1. Seems like this error is caused by the underscore in the domain name (HOST_XXX)? Would it be possible to allow the host with “_” if this is the right workaround?

  2. What’s the recommended workaround when you can’t modify the host header in webhook configurations?

Any guidance would be appreciated!

The recommended solution here is to hit the api directly in the code repo using an agent proxy policies.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.