Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config option for disable SSL check #21

Closed
svenez opened this issue Oct 12, 2021 · 7 comments
Closed

Config option for disable SSL check #21

svenez opened this issue Oct 12, 2021 · 7 comments

Comments

@svenez
Copy link

svenez commented Oct 12, 2021

Sending request to host that has self-signed cert raises an error

GotError [RequestError]: self signed certificate

any options to avoid this?

@mrhyde
Copy link
Member

mrhyde commented Oct 12, 2021

I will have to investigate this

@mrhyde
Copy link
Member

mrhyde commented Oct 12, 2021

You can set NODE_TLS_REJECT_UNAUTHORIZED environment variable to 0. Doing so will disable certificate validation in node, which is not the best option for production but so does self-signed certificate.
Let me know if this solution works for you.

@mrhyde
Copy link
Member

mrhyde commented Oct 12, 2021

You can always set env variables from JS/TS code itself

process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;

@svenez
Copy link
Author

svenez commented Oct 13, 2021

Yea, this solves the problem, but I dont want to disable it globally, setting ENV var will affect some other parts of my code

@mrhyde
Copy link
Member

mrhyde commented Oct 13, 2021

I will make a patch tonight with an option to disable validation just for the HTTP client.

@mrhyde
Copy link
Member

mrhyde commented Oct 14, 2021

An option to override HTTP client behavior was implemented in 8555802 that will be published on NPM after I will run some more tests

@mrhyde
Copy link
Member

mrhyde commented Oct 16, 2021

Version 2.4.0 was published on NPM. Let me know if it works for you:

const bitrix = Bitrix('https://PORTAL_NAME.bitrix24.ru/rest', 'ACCESS_TOKEN', {https: { rejectUnauthorized: false }})

@mrhyde mrhyde closed this as completed Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants