Configuration:
Navigating to a page that does not exist (e.g. https://proxy-hostname/test/) redirects to the carbon admin console (https://proxy-hostname/carbon/admin/login.jsp)
We do not wish end users to be directed towards the admin console if they enter an incorrect URL.
Question: Is is possible to reconfigure this 404 redirect to a different URL by updating WSO2 API Manager configuration?
Research: I have found two previous (answered) questions:
Can you change the WSO2 root redirect?
WSO2 Application Server will redirect to "/carbon" upon 404 error is expected
These answers suggest editing the repository/conf/carbon.xml file setting.
However, API Manager 4.2.0 configuration process has changed compared to previous product releases, so editing xml files as per these old answers (for previous release versions) will get overritten upon restart.
AFAIK there is no way to do this within the Application layer. The easiest solution is to do this at NGINX. You can whitelist all the contexts you want to allow and add a default block to return an error for all the others.
Update
Naginx contexts to whitelist.