0

I am making an app for my own use, when I try to post JSON to my PHP server at example.com, I get the following error:

Uncaught Error: self signed certificate error

I tried the following code and it works:

process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0

but I believe this approach is dangerous. What is the safe way to solve this error? I tried googling but did not find anything useful or maybe because I am a beginner I did not understand it.

theduck
  • 2,589
  • 13
  • 17
  • 23
fardad
  • 29
  • 1
  • 9

1 Answers1

0

I assume your self signed cert is on example.com and wherever your posting from doesn't trust it.

You may want to check out this answer for how to create and use self signed certs from iOS, Android, and a browser.

ScottyB
  • 2,167
  • 1
  • 30
  • 46