Is it possible to respond with an error when a request to get a module outside of a specific naming rule comes in?

For the proxy repository, is it possible to respond with an error when a request to get a module outside of a specific naming rule comes in? I would like to know if there is a way to set it up like that.
The version of nexus is “3.20.1-01”.

You should be able to use routing rules to limit the remote requests from a proxy repository.

https://help.sonatype.com/repomanager3/nexus-repository-administration/repository-management/routing-rules