Prevent Custom Name Servers from Resolving to 404 Error

I have recently set up my own custom name servers (ns1.name.com and ns2.name.com) using CyberPanel. However, when someone enters either of these addresses into a browser, they are resolved with a 404 error. I would like to prevent these name servers from being resolved when accessed directly in a browser, while still being able to use them for pointing domain names.

Is there a way to accomplish this without affecting the functionality of the name servers for domain management? If so, could you please guide me through the necessary steps or provide any relevant resources?

Thank you in advance for your help and insights!