Wednesday, March 16, 2022

[SOLVED] Http-server to access the application without port

Issue

So I have a web application being run on an http-server via npm. In my package.jsonfile, I have the line "start": "http-server dist --ssl", and my app runs fine when I go to href="https://myipaddress:8080" rel="nofollow noreferrer">https://myipaddress:8080. However if I change the url to just http://myipaddress, i cant access the application

So in short, how cant i run the application so i can access it from https://myipaddress and not https://myipaddress:8080 ?


Solution

A browser without special plugins (i.e. HTTPS Everywhere) expects port 80 for http:// scheme. If you used https://myipaddress, then it would expect port 443.

So in order browser call to http://myipaddress you need two actions:

NGINX or other reverse proxy might help.

You could make http-server to listen on localhost:8080 without SSL and place NGINX so it would redirect http://myipaddress:80 to https://myipaddress:443 and proxy https://myipaddress:443 to http://localhost:8080

Also, keep in mind that listening on a port lower than 1024 needs root user permissions on Unix systems.



Answered By - KarolisL
Answer Checked By - Cary Denson (WPSolving Admin)