You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All non-GET requests return 403 Forbidden when using https
bug: I'm working with HTTPS. I can read the db.json just fine with GET requests. But all POST, PUT, PATCH, etc. requests to write to the file return 403 Forbidden.
Environment Details
api-now version: 0.5.4
OS: Windows 10
Node.js version: 16.13.2
Long Description
I'm working with HTTPS. I can read the db.json just fine with GET requests. But all POST, PUT, PATCH, etc. requests to write to the file return 403 Forbidden. The following screenshot is from the Fiddler tool. The same thing is seen in the console of the F12 tools.
This screenshot is of the server window:
constgetData=()=>{fetch('https://localhost:3001/posts/1')//api for the get request.then(response=>response.json()).then(data=>console.log(data));};constnewPost={"id": 2,"title": "json-server","author": "Rick"}// Options to be given as parameter// in fetch for making requests// other then GETletoptions={method: 'PUT',headers: {'Content-Type': 'application/json;charset=utf-8'},body: JSON.stringify(newPost)}constsetData=()=>{fetch('https://localhost:3001/posts/1',options)//api for the set request.then(response=>response.json()).then(data=>console.log(data));};
Workaround
none
...
(Please help with a PR if you have a solution. Thanks!)
The text was updated successfully, but these errors were encountered:
UPDATE: It really has nothing to do with HTTPS. It happens with HTTP too. The problem is that the server needs to set CORS headers and the documentation doesn't say how to do that.
All non-GET requests return 403 Forbidden when using https
Environment Details
Long Description
I'm working with HTTPS. I can read the db.json just fine with GET requests. But all POST, PUT, PATCH, etc. requests to write to the file return 403 Forbidden. The following screenshot is from the Fiddler tool. The same thing is seen in the console of the F12 tools.
This screenshot is of the server window:
Workaround
none
...
(Please help with a PR if you have a solution. Thanks!)
The text was updated successfully, but these errors were encountered: