How can I send a custom error message to front end when the endpoint coming from front end does not match with any URL in ROOT_URLCONF in settings.py. Currently if URL is not found in ROOT_URLCONF, a 403 error is raised and the entire html content is going in the error message.
How to send a custom error message in this case.
You could have a custom error handler function returning a json string
Then in your urlconf file you can set it to
handler404 = 'not_found_request'