Home
Support Forums

Problem with api

hello dear

after deploying react to netlify I have problem when send post request in netlify website give me this error

POST https://hershcompany.com/api/v1/request/addRequest 404 (Not Found)

get methods is work perfect but only post and put is not work also no problem when I test in postman

Note : my API is hosted in vps ubunutu.

Hi @mohamednazm-web

Welcome to the forums.

Can you provide the URL of your website?

Edit:
Doesn’t appear as though this is a Netlify-specific issue. Not found is returned in the browser too

sir my url is post method but you try the get request so that is happen

I tried posting to the URL too

curl -X POST
     -d '{data: "something"}'
     'https://hershcompany.com/api/v1/request/addRequest'

Not found was returned again.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Not Found</pre>
</body>
</html>

If you can provide the URL of your Netlify site, and how you are making this call (I assume you are calling directly and not via a proxy) this may help provide you further assistance.

im sorry for late response

this is my all configuration

_redirects
/api/* https://hershcompany.com/:splat 200
/* /index.html 200

_headers
/*
Access-Control-Allow-Origin: *

package.json
“proxy”: “https://hershcompany.com”,

when I convert to localhost and then try it all of this is work but after deploying in netlify is not work

also i call in here only get method i mean retrive data is work

import axios from “axios”

// const baseUrl = “http://localhost:4000

const baseUrl = “https://hershcompany.com

const API = axios.create({

baseURL: baseUrl,

})

export { API }

Can share the URL for the Netlify site you are calling the API from?

Thank you I solved :relieved: thank you for your information :pray: