How can I test Turpentine with existing Turpentine/Varnish servers

Leveraging for a superior Magento Turpentine Varnish setup is a common use case. I’d like to share my notes on a key migration step: Testing with your existing setup still serving customers.

This assumes you have followed the Turpentine guidelines and setup the CLI bridge.

The origin environment currently looks something like this: Nginx/Apache(Hosting SSL) -> Varnish -> Nginx/Apache (Magento)
When the origin Varnish servers are in play they intercept the Turpentine ESI tags in the HTML documents and this means that the Varnish layer doesnt get to see them.

We need the origin environment to end up looking like Nginx/Apache (Hosting SSL) -> Nginx/Apache (Magento) so that Varnish layer can sit infront of this.

A good way to action this would be to make a small change to the Nginx/Apache (Hosting SSL) Layer and add another server block OR virtual host (or similar) there - You would copy the existing configuration for 80 and 443 and assign these to random ports like 5080 and 5443.
The configuration of these blocks would be slightly different to pass traffic straight to Nginx/Apache(Magento).

With the above approach, You can quickly complete functional testing on an environment as the CDN will connect back to the new port ranges and current users will connect to the existing path.

When you go live traffic will start to entirely pass through the new port ranges and you have a quick means of testing/rollback if needed.