<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
1.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Is there any way to normalize host headers and other things to say to varnish not to cache the same content for different backend?<br>
I want to use round robin director but after fetching the content I want to normalize the header and cache the content,<br>
I would appreciate if you give me an example about this and how I can do it.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
2.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I couldn't find any good example for directors-shard and xshard-key-string, I would appreciate if you could give example about this too.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Many Thanks<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> varnish-misc <varnish-misc-bounces+hrhosseini=hotmail.com@varnish-cache.org> on behalf of Hamidreza Hosseini <hrhosseini@hotmail.com><br>
<b>Sent:</b> Sunday, August 1, 2021 4:17 AM<br>
<b>To:</b> varnish-misc@varnish-cache.org <varnish-misc@varnish-cache.org><br>
<b>Subject:</b> Best practice for caching scenario with different backend servers but same content</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi,<br>
I want to use varnish in my scenario as cache service, I have about 10 http servers that serve Hls fragments as the backend servers and about 5 varnish servers for caching purpose, the problem comes in when I use round-robin director for backend servers in
 varnish,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
if a varnish for specific file requests to one backend server and for the same file but to another backend server it would cache that file again because of different Host headers ! so my solution is using fallback director instead of round-robin as follow:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
```</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
In varnish-1:
<div>    new hls_cluster = directors.fallback();</div>
<div>    hls_cluster.add_backend(b1());</div>
<div>    hls_cluster.add_backend(b2());    </div>
<div>    hls_cluster.add_backend(b3());    </div>
<div>    hls_cluster.add_backend(b4());    </div>
<div>    hls_cluster.add_backend(b5());    </div>
<div>    hls_cluster.add_backend(b6());    </div>
<div>    hls_cluster.add_backend(b7());    </div>
<div>    hls_cluster.add_backend(b8());    </div>
<div>    hls_cluster.add_backend(b9());    </div>
<div>    hls_cluster.add_backend(b10());</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>In varnish-2:</div>
<div>    new hls_cluster = directors.fallback();</div>
<div>    hls_cluster.add_backend(b10());</div>
<div>    hls_cluster.add_backend(b1());</div>
<div>    hls_cluster.add_backend(b2());    </div>
<div>    hls_cluster.add_backend(b3());    </div>
<div>    hls_cluster.add_backend(b4());    </div>
<div>    hls_cluster.add_backend(b5());    </div>
<div>    hls_cluster.add_backend(b6());    </div>
<div>    hls_cluster.add_backend(b7());    </div>
<div>    hls_cluster.add_backend(b8());    </div>
<div>    hls_cluster.add_backend(b9());    </div>
<div><br>
</div>
<div><br>
</div>
<div>In varnish-3:</div>
<div>    new hls_cluster = directors.fallback();</div>
<div>    hls_cluster.add_backend(b9());    </div>
<div>    hls_cluster.add_backend(b1());</div>
<div>    hls_cluster.add_backend(b2());    </div>
<div>    hls_cluster.add_backend(b3());    </div>
<div>    hls_cluster.add_backend(b4());    </div>
<div>    hls_cluster.add_backend(b5());    </div>
<div>    hls_cluster.add_backend(b6());    </div>
<div>    hls_cluster.add_backend(b7());    </div>
<div>    hls_cluster.add_backend(b8());    </div>
<div>    hls_cluster.add_backend(b10());</div>
<div><br>
</div>
<span></span>```<br>
But I think this is not the best solution, because there is no load balancing despite, I used different backend for the first argument of fallback directive,<br>
What is varnish recommendation for this scenario?</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
</div>
</body>
</html>