How to modify backend content before it reach to client's browser?

fulan Peng fulanpeng at gmail.com
Sat Feb 6 01:12:23 CET 2010


Thank you for your response.

I am not looking to include additional content or synthetic something
to the content. I am trying to rewrite the url in the content. This
can be done by Apache mod_proxy_html. I made it working. But Apache
breaks some web pages. I want to try something else.
Yes. I want to change the content "on the fly". I found only Apache
mod_proxy_html and Microsoft IIS .NET something can do it.  All others
are not able to do this.
I would try inline C at Varnish. I do not want do anything with Microsoft.
Thanks !

Fulan Peng


On Fri, Feb 5, 2010 at 9:04 PM, Richard Chiswell
<richard.chiswell at mangahigh.com> wrote:
> Hello Fulan,
>
> I'm not sure what you are asking from Varnish. You could use its ESI (
> http://varnish-cache.org/wiki/ESIfeatures ) to include additional content or
> "synthetic" ( http://varnish-cache.org/wiki/VCLSyntaxStrings ) to set the
> content. I don't think you are able to change the contents of URLs "on the
> fly" in Varnish without using inline C.
>
> If you are actually looking at redirecting URLs, you may find code such as:
>
> sub vcl_recv {
> ....
> if (req.url ~ "^/rgb([A-z0-9]+)$") {
>       error 750 "ukredirect";
> }
> ...
> }
> sub vcl_error {
> ...
>   if (obj.status == 750) {
>   if (obj.response == "ukredirect") {
>        set obj.http.Location = "http://" req.http.host
> regsub(req.url,"^/rgb([A-z0-9]+)$","/en_gb/?utm_source=ukredirect&utm_medium=web&utm_campaign=\1");
>        set obj.status = 301;
>        set obj.response = "Found";
>        deliver;
>   }
> }
> ...
> }
> useful to redirect the users browser without touching the backend.
>
> Yours,
> Richard
>
> fulan Peng wrote:
>>
>> Hi,
>>
>> I am looking for the functionality similar to Apache's mod_proxy_html.
>> It can modify backend's content before it reach to customer. I used it
>> to rewrite url in the links.
>>
>> Usually, when people are talking about url rewriting, they mean to
>> rewrite the url before send out to backend. That is varnish's url
>> rewriting. That is not I want.
>>
>> Thanks a lot!
>>
>> Fulan Peng
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at projects.linpro.no
>> http://projects.linpro.no/mailman/listinfo/varnish-misc
>>
>
>



More information about the varnish-misc mailing list