A
A
Alexey2018-08-15 22:23:22
Nginx
Alexey, 2018-08-15 22:23:22

NodeJs web server and Cloudflare. Will it be possible to win?

Available:
1) Server with NGINX
2) On this server, 2 virtual hosts are installed in NGINX (https protocol, 2 different domains). Both domains are powered by Cloudflare.
3) There is a NodeJS (HapiJS) web server activated on port 5000. Works through Cloudflare
What you need:
NGINX-based virtual hosts with Cloudflare work perfectly.
The problem is in NodeJs web server. When accessing xxx.xxx.xxx.xxx:5000 directly, everything works, but if I activate the CDN in Cloudflare, NGINX 404 is immediately displayed and my server becomes inaccessible via the domain URL.
those.

activated DNS and CDN Cloudflare
xxx.xxx.xxx.xxx:5000 everything works
xxxxxxxxxx.com:5000 NGINX error and nothing is available
The main task is to hide the IP of the server when accessing the NodeJs web server (i.e. access via CDN). I note that the NodeJs web server does not carry any statics, it is a REST API.
I do not have much experience in setting up these servers, etc., tell me if I can fix this situation and in general, does anyone use Cloudflare for the REST API?

Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2018-08-15
@azovl

Cloudflare cannot be used for free for anything other than websites and their traffic i.e. ports 80/443, etc.
If you want to forward any ports and traffic - pay overdose of money - you need an Enterprise plan.
https://support.cloudflare.com/hc/en-us/articles/2...

M
Mysterion, 2018-08-15
@Mysterion

On the server with NodeJS, install Nginx, create a virtual host there with a redirect to local port 5000, set the domain to the one specified in Cloudflare for NodeJS.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question