Force HTTPS doesn't work

Force HTTPS rule doesn’t work with express.js application. I have added .htaccess file in public_html but it still doesn’t work. Any idea why?

My .htaccess file:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]