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

🐛 BUG: Getting 404 when fetch api route behind cloudflare dns/proxy #7367

Closed
dekadenns opened this issue Nov 27, 2024 · 0 comments
Closed
Labels
bug Something that isn't working

Comments

@dekadenns
Copy link

Which Cloudflare product(s) does this pertain to?

Workers Runtime

What version(s) of the tool(s) are you using?

3.91.0 [wrangler]

What version of Node are you using?

20.14.0

What operating system and version are you using?

22.04.1-Ubuntu

Describe the Bug

Observed behavior

Cloudflare worker with email handler isn't able to reach an application behind cloudflare dns/proxy deployed in hetzner through fetch.
Get a 404 back, application endpoint is not triggered.

Works fine in the same worker using an fetchHandler and calling the worker URL.
Also works fine, when the application is running locally and the worker is calling the endpoint through a temp cloudflare tunnel.

Expected behavior

Expection is that the fetch request in the emailHandler reaches the application and did not get a 404 back.

Steps to reproduce

Please provide the following:

  • A minimal working subset of your worker code
const APP_URL = "https://preview.example.ai/v1/endpoint/"
const TUNNEL_URL = "https://one-two-three-four.trycloudflare.com/v1/endpoint/"

export default {
  async fetch(request, env): Promise<Response> {
    //Works fine, response from the app endpoint
    const response = await fetch(APP_URL);
    return response;
  },

  async email(message, env) {
    //Did not work, response.status = 404
    const response = await fetch(APP_URL);
    console.log(response)

    //Works fine, response from the app endpoint
    const responseTunnel = await fetch(TUNNEL_URL);
    console.log(responseTunnel)
  }
}

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

@dekadenns dekadenns added the bug Something that isn't working label Nov 27, 2024
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Nov 27, 2024
@github-project-automation github-project-automation bot moved this from Untriaged to Done in workers-sdk Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
Status: Done
Development

No branches or pull requests

1 participant