In my case the problem was that my controller threw an exception, thus the framework tried to use the exception handler page which was no available, thus the 404 error, the controller itself was throwing 500 error
In my case the problem was that my controller threw an exception, thus the framework tried to use the exception handler page which was no available, thus the 404 error, the controller itself was throwing 500 error