Skip to content

All non-GET requests return 403 Forbidden when using https #8

@Rick-Kirkham

Description

@Rick-Kirkham

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.

image

This screenshot is of the server window:

image

const getData = () => { 
  fetch('https://localhost:3001/posts/1')           //api for the get request
  .then(response => response.json())
  .then(data => console.log(data));
};

const newPost =  {
  "id": 2,
  "title": "json-server",
  "author": "Rick"
}
// Options to be given as parameter
// in fetch for making requests
// other then GET
let options = {
	method: 'PUT',
	headers: {
		'Content-Type':	'application/json;charset=utf-8'
	},
	body: JSON.stringify(newPost)
}

const setData = () => { 
  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!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions