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

I receive a 404 response when the Origin header is specified. #13591

Open
rafaelmaia8384 opened this issue Feb 28, 2025 · 2 comments
Open

I receive a 404 response when the Origin header is specified. #13591

rafaelmaia8384 opened this issue Feb 28, 2025 · 2 comments
Labels
in linear Issue or PR has been created in Linear for internal review In Review We are reviewing the issue

Comments

@rafaelmaia8384
Copy link

rafaelmaia8384 commented Feb 28, 2025

Bug Description

I'm trying to consume a webhook. The endpoint is https://domain.com/webhook-test/register/

curl -X POST 'https://domain.com/webhook-test/register/' \
-H 'Origin: https://domain.com' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: */*' \
--data-urlencode 'key=value'

I included the Origin header to simulate a request from the browser. Even though the domain is the same (origin and destination), I receive a 404 error.

{"code":404,"message":"The requested webhook \"register/\" is not registered.","hint":"Click the 'Test workflow' button on the canvas, then try again. (In test mode, the webhook only works for one call after you click this button)"}

When I remove the Origin header, the webhook works perfectly.

I've already tried adding the Access-Control-Allow-Origin header in every possible way, using * and the domain name, but the error persists.

To Reproduce

  1. Create a POST webhook
  2. Specify the path register/
  3. Add the response header Access-Control-Allow-Origin: *
  4. Call the webhook using curl
curl -X POST 'https://domain.com/webhook-test/register/' \
-H 'Origin: https://domain.com' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: */*' \
--data-urlencode 'key=value'

Expected behavior

Should return the webhook response.

Operating System

Ubuntu 24.04 running on Docker behind nginx proxy.

n8n Version

1.79.3

Node.js Version

v20.18.2

Database

PostgreSQL

Execution mode

queue

@Joffcom
Copy link
Member

Joffcom commented Feb 28, 2025

Hey @rafaelmaia8384,

We have created an internal ticket to look into this which we will be tracking as "GHC-997"

@Joffcom Joffcom added in linear Issue or PR has been created in Linear for internal review In Review We are reviewing the issue labels Feb 28, 2025
@rafaelmaia8384
Copy link
Author

After some tests, I noticed that the webhook path "register/" (with a trailing slash) seems to be the cause of the issue. When the slash is removed, the webhook works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review In Review We are reviewing the issue
Projects
None yet
Development

No branches or pull requests

2 participants