GitLab Project Webhook URL "Invalid URL Given" (422), but Works as System Hook

I'm trying to add a project-level webhook in GitLab.

The webhook URL is:

http://172.30.15.171/api/gitlab/webhook/info?userid=599&projectid=9944

This is an internal VPN IP that is accessible from the GitLab server. I can ping it successfully, and system hooks work perfectly using the same URL.

Using the same URL with:

$gitclient->systemHooks()->create($hookUrl, [...]);

System hook is created and executed successfully.

Trying to create a project hook:

$gitclient->projects()->addHook($projectId, $hookUrl, [
    'push_events' => true,
    'enable_ssl_verification' => false
]);

Results in:

{
  "error": "Invalid url given",
  "code": 422,
  "type": "exception"
}

What I've tried

  • I tried adding the hook manually in GitLab, same error is thrown: "Invalid URL."
  • Removed query parameters — still fails.
  • Replaced IP with a domain (http://hook.localhost/...) — still fails unless public.
  • Checked project-level access — using OAuth token with api scope.
  • System hook with same IP and URL — works flawlessly.

Confirmed:

  • The GitLab server can reach 172.30.15.171.
  • Webhook server is running and accepts HTTP 200.
  • This is a self-hosted GitLab CE/EE instance.

It seems GitLab allows internal IPs for system hooks, but restricts internal/private IP addresses for project hooks — likely as a security measure.

How can I allow internal/VPN IPs like 172.30.x.x to be accepted in project hooks?