Conflict with NodeJs and .htaccess

I Moved one of my websites to Cloudflare.
but it seem is not working , I note that I have the following setting in my .htaccess which
redirect the traffic to port 49000 which run a NodeJs app


<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{QUERY_STRING} !^q=
RewriteRule ^(movie|tv)/([0-9]+)/([a-zA-Z0-9-]+)/?$ https://aflam.vip/$1/$2/$3?q=$3 [R=301,L]

RewriteCond %{SERVER_PORT} 443
RewriteRule ^(api|test)($|/) - [L]
RewriteRule ^index.php$ http://107.6.183.140:49000/$1 [P,L]
RewriteRule ^(.*)$ http://107.6.183.140:49000/$1 [P,L]
 </IfModule>

Please advice me what should I do to?

Can you describe exactly what doesn’t work? How have you configured this within Cloudflare?

Website keep loading in a white screen for ever. And dos not working unless i remove Cloudflare connection.

It seems there my server try to connect to the ip of the domain, while the domain start having different ip address.

Moreover how can i tell Cloudflare to go to

http://107.6.183.140:49000 and enable https.

Regard

If you create a DNS A record pointing at that IP, and use Origin Rules, you should be able to do that I believe.

You will likely need to use Flexible SSL if you do this, which I would heavily advise against and instead recommend you setup a proper HTTPS configuration at your origin.

Also as a note, keep in mind the Cloudflare TOS when it comes to streaming video content. You’re quickly going to hit clauses in the TOS that prevent this kind of thing if you’re not using Stream, R2, or have some other Enterprise arrangement.

Thank you so much.
My problem is following
I can not run NUXST on 443 port on my server and i don’t know why.
when I run on 443 I have ERR_SSL_PROTOCOL_ERROR

that is why I used

RewriteCond %{SERVER_PORT} 443
RewriteRule ^(api|test)($|/) - [L]
RewriteRule ^index.php$ http://107.6.183.140:49000/$1 [P,L]
RewriteRule ^(.*)$ http://107.6.183.140:49000/$1 [P,L]

to forward to the http://107.6.183.140:49000

regarding your reply, I just checked Origin Rules and I don’t see how it will help me out.
I need Cloudflare to open my website via the IP Address, am not sue if this is correct or not.

Am on Cpanel hosting and An cPanel provide SSL to the host.

Please advice

@cherryjimbo I like to add that the domain is an addon domain in my cpanel.
So I can not assign an IP address to the domain.

I change the port on my server to be 8443 which supported by Cloudflare, but how can point Cloudflare to

http://107.6.183.140:8443

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.