Rewriting URL's or Content inside a req object using regsub or regsuball

Harry Yeh hyeh at
Fri Jan 7 06:25:06 CET 2011

I am currently having some success with the Reverse Proxying features of
Varnish, and the only thing left that I need to be able to do is essentially
rewrite some of the URL's in the body.

For example, we have a url internally that might be and we
need the url's in the HTML page to be rewritten to

Right now I am kind of stuck but I am assuming I should be doing something
similar to following? I have not idea which beresp object I should use for
the body of the content since there is no documentation.

 sub vcl_fetch {

if ( == "" && req.url ~ "^/blogs"){
set beresp = regsuball(beresp, "^", "");
     if (!beresp.cacheable) {
         return (pass);
     if (beresp.http.Set-Cookie) {
         return (pass);
     return (deliver);


Harry Yeh
Twitter <>
Facebook <>
When you think thong <>, think Rupaz<>

Web: <>
Confidentiality Notice:

This electronic mail transmission and any accompanying attachments contain
confidential information intended only for the use of the individual or
entity named above. Any dissemination, distribution, copying or action taken
in reliance on the contents of this communication by anyone other than the
intended recipient is strictly prohibited. If you have received this
communication in error please immediately delete the E-mail and notify the
sender at the above E-mail address.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list