We're running a dev server on some IP and have our API exposed on port 5000 and nginx listening on 80. However, the entire backend will crash when one makes an HTTPS request to port 5000. Thus, I noticed a vulnerability, that when one accesses https://SERVER_IP:5000, since it can't handle the HTTPS request, the request hangs and the entire backend stalls (so the API hangs for any other requests as well). I just want that request to never reach the backend.
I have the following rules set up for UFW.
To Action From -- ------ ---- 8000 ALLOW Anywhere 22/tcp ALLOW Anywhere 80 ALLOW Anywhere 5000 ALLOW Anywhere 443/tcp DENY Anywhere 8000 (v6) ALLOW Anywhere (v6) 22/tcp (v6) ALLOW Anywhere (v6) 80 (v6) ALLOW Anywhere (v6) 5000 (v6) ALLOW Anywhere (v6) 443/tcp (v6) DENY Anywhere (v6)
However, when one navigates to https://SERVER_IP:5000, the server still crashes. I think this is because https traffic is not necessarily coming in on port 443 but rather 5000 and that's exposed (which it needs to be only for HTTP traffic). So is there some way I can disallow HTTPS traffic on 5000 through UFW or do I have to configure something with nginx?