When you run your application locally, it has the address ‘http://localhost:8080’, but when you publish your application, the rest address also changes accordingly,
Make sure, that you have made changes to the consuming services, for the address of the rest call.
This way, it won’t give any errors,
Let me know, if you have any issues,
Hope it helps!!
Be aware that when deploying your application the path to the rest handler needs to have permissions.
Open your project in the cloud portal and navigate to the environment and select the tab network.
Then review the permssions setup under “Path based access restrictions”. As you are getting a 404 (resource does not exist) the permissions for the /rest path is probably incorrectly configured.