I'm considering how to handle Server to Server Notifications (S2S Notifications) for multiple server environments.
I have two servers; one is for staging, the other is for production.
I want to:
- direct the sandbox notifications to the staging server
- direct the production notifications to the production server
However, the following reasons make the above difficult.
- Just one notification endpoint URL can be set for an app.
- All the S2S Notifications are sent to the same endpoint URL regardless of the type of notification (production/sandbox).
Therefore I came up with some ideas. I want to know if these are good ideas or any other reasonable solutions.
■Solution 1
Register two apps in App Store Connect, and use one as the test app, which will never be released. This way allows me to register two endpoint URLs. I wonder if this was a common solution, although I don't think it is an excellent idea to register apps that won't be released on App Store Connect.
■Solution 2
Receive all the notifications at one endpoint on the production server, and store them in the production database. Then forward the sandbox notifications to the staging environment by a batch script. With this solution, I'm worried that the source code between the production server and the staging server has to be different.
■Solution 3
Set the endpoint URL of a proxy server to receive the S2S Notifications. The proxy server is aware of the notification type (production/sandbox) and sends it to the appropriate server.
I'm concerned that the risk of failure increases due to adding the proxy server in my system. And the security risks may increase as well.
Any advices or suggestions?