J
J
Jiestie2018-10-16 02:48:30
Nginx
Jiestie, 2018-10-16 02:48:30

How to limit process requests to third-party services using nginx if service requests must be via https?

There is a node.js process that makes requests to services, services have a limit of requests per second,
`

limit_req_zone $arg_userident zone=mylimit:10m rate=10r/s;
server {
listen 9333;
ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;
ssl on;
location /route/{
limit_req zone=mylimit burst=2000;
proxy_pass https://limit_service.com/;
}
}

`
if I send requests from a node, I get an error
ERROR >>> { Error: self signed certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1046:34)
at TLSSocket.emit (events.js:180:13)
at TLSSocket._finishInit (_tls_wrap.js:633:8) code : 'DEPTH_ZERO_SELF_SIGNED_CERT', response: undefined }

For it to work, you need to specify
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

same thing with curl- does not work unless you specify the -v flag.
What is the problem, how to fix it? How is this called a proxy? or reverse proxy? or what is it anyway?
Also, such a question - can I somehow hide this nginx port from the external Internet, from port scanners using iptables? But at the same time retain its ability to receive answers to its own requests?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
Hikmat Abdunabiev, 2018-10-16
@Khikmat

Look at the nginx manual: https://docs.nginx.com/nginx/admin-guide/security-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question