404 Error when reverse-proxying to the Netlify site

1. The problem I’m having:

I have a website mywebsite.com. I want to reverse proxy the requests to the frontend hosted on Netlify. The Netlify site has a _redirects file /* /index.html 200 such that client-site react-router works properly when visiting mywebsite.netlify.app. But I visit mywebsite.com it shows 404 error page from Netlify server side.

2. Error messages and/or full log output:

Netlify html Page Site Not Found. Not error messages in caddy log

3. Caddy version:

v2.7.4 h1:J8nisjdOxnYHXlorUKXY75Gr6iBfudfoGhrJ8t7/flI=

4. How I installed and ran Caddy:

a. System environment:

Ubuntu 22.04.2 LTS (AWS EC2 AArch64)

b. Command:

sudo systemctl start caddy

c. Service/unit/compose file:

null

d. My complete Caddy config:

mywebsite.com {
	handle /api/* {
    reverse_proxy localhost:8080
  }

  handle /ws {
    reverse_proxy localhost:8080
  }

  handle /ws/* {
    reverse_proxy localhost:8080
  }

  handle {
    reverse_proxy mywebsite.netlify.app
  }
}

mywebsite.com:80 {
        redir https://mywebsite.com
}

5. Links to relevant resources:

We can’t help you debug problem with your upstream app, especially without sharing your Caddy logs. You’ll need to get help from Netlify support.