I have a cdn endpoint with origin to a production web app. When I swap staging to production, since there is a VIP swap, the cdn endpoint now points to staging VIP instead of Production VIP. How to handle this scenario?
Generally speaking - CDNs don't care about ORIGIN changing, most caching rules leverage TTL along with Last Modified or eTags. This means that the CDN will eventually be consistent with your ORIGIN, depending on your cache headers you send to the CDN for responses.
If you want the content in the CDN to always match what is in your PROD slot you need to add a version hash to your CDN links OR call the CDN API and purge the CDN assets after deployment to ensure latest content is fetched again from the ORIGIN to the PoPs.