How to change token expired Http response code from 404 to 401..?

I am using keyclaok 10.0.2 latest version, we are able go get token from keyclaok successfully after that we will pass authorised token to api but after expired token we have to refresh the token from keyclaok but when token expired then it will return 404 http response code instead of 401 http response code.

So i request you please suggest how to change http response code from 404 to 401.

Token API
http://localhost:8080/auth/realms/test/protocol/openid-connect/token

Request Body
client_id=test-app
grant_type=password
username=username
password=password
client_secret=client_secret

After that we are able to get authorised token

After that we will Authorized API
http://localhost:8081/api/dashboard/observations/
Header : access_token

after expired token it will return 404 http response code instead of 401

please suggest how to change response codeā€¦?

Hi Team, please anyone help on above issue.

Hi Team, please anyone help on above issue.