I was wondering, If there is a (private) application or service deployed at example.com:5000, how can someone prevent undesired requests to that port ?
I was thinking about a solution were the credentials for the user should be sent in the first request to the application and it should then answer back with some session token (like a cookie?) that you can attach to each one of your following requests. Maybe another security measure could be to use fail2ban with the application logs.
Furthermore, is there any library to easily implement something similar in NodeJS, Python, Java or C++ (or any other) ?