How do i POST to WordPress rest API from the same domain?

I created a custom rest API route – > http://mydomain/wp-json/v1/wp/custom/user now this POST request to this route works perfectly from a remote host. Some things change in my dev env and the JS files need to be hosted locally and my request no longer work and is now returning xhr.js:178 POST http://mydomain/wp-json/v1/wp/custom/user 404 (Not Found) .

How do should I configure my POST request to work inside my WordPress site?

Thank you,