Search squid archive

Re: adding a parameter to a URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shaine,

Because you use the 302: prefix the URL that you pass back from the redirector
to Squid is sent back to the browser and because of the 302 the browser
sends a new request to Squid and the new URL is the URL that the redirector sent
in the first place.  This URL is passed by Squid to the redirector and now you
have an endless loop.

solution:
- do not use the 302: prefix, or
- modify your perl code so that it checks for "orchard=66677722" in which case it must not rewrite the URL.

-Marcus


Shaine wrote:
Dear friedns,
I am really fed up with url -redirecting program which i have used for
redirect specific url comes and validate by the url -rewriting program . It
wasnt gave me any errors at initial steps.But now when i try to access
google or any url , its repating ( url * n ) ,

eg:-
:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com

following is my perl code ( url-redirecting program )

#!/usr/bin/perl
# no buffered output, auto flush
$|=1;
$temp = "";

while (<STDIN>){
  @array = split(/ /);
  if (!(@array[1] =~ m#orchard#)) {
    $temp = "302:" .  @array[1];
    if (@array[1] =~ m/\?/) {
      $temp .= "&orchard=66677722";
    }else {
      $temp .= "?orchard=66677722";
    }
    s#@array[1]#$temp#;
    print;
  }else {
    print;
  }
}


Can somebody help me to solve my issue ? please help me. actually why it is
happening like that .

Many thanks
Shaine.




Sylvain Viart-2 wrote:
Hi Shaine,

Shaine a écrit :
I have a big problem with adding a parameter to a URL which passes via
squid
. For that i am going to use url_rewrite program. I had a big time with
squid url rewriting, but no success.
Could you please tell me , to get in to my point what are the minimum
requirement to be satisfied ?
I haven't tested to rewrite the querystring part of the url, but it's available on the redirector (rewrite_program)

Here's sample input for the rewrite_program

0 http://www.somedomain.com/thumb/100/3/b/2/7/3b279a6eab3d0a983d9tre.somedomain.com/messenger/messPing.php 12.34.56.78/- - POST - 0 http://subdom.somedomain.com/thumb/55/3/c/3/6/3c36046ed06c78b2b65627f660be6220.jpg 12.34.56.78/- - GET - 0 http://www.somedomain.com/thumb/100/3/6/8/4/3684949288972604fafdb167ffc214d5.jpg 12.34.56.78/- - GET - 0 http://www.somedomain.com/thumb/100/7/a/4/1/7a4113fd5fba8ec93fa6bf82a6c993be.jpg 12.34.56.78/- - GET - 0 http://www..somedomain.com/thumb/100/4/3/d/f/43df2ca304f508557294d3a835a6fd29.jpg 12.34.56.78/- - GET -

The digit in the first position is only present when url_rewrite_concurrency is used, see

The thread : url_rewrite_concurrency singlethreaded redirector
performance?

http://www.mail-archive.com/squid-users@xxxxxxxxxxxxxxx/msg49897.html

url_rewrite_program
url_rewrite_children
url_rewrite_concurrency
url_rewrite_host_header on|off url_rewrite_access allow|deny acl ...
I use :
url_rewrite_program /etc/squid/redirector.pl
url_rewrite_children 100
url_rewrite_concurrency 50
url_rewrite_host_header off


which means :

100 process spawned (busy proxy)
url_rewrite_concurrency 50, means squid can pass up to 50 URL to the program using a counter

url_rewrite_host_header off, means that redirector rewrites the URL, but squid keep the original URL, useful in accelerator mode (surrogate), See the doc, to be sure.
how it should like , url rewrite program ? can somebody leave me a simple
example ?
Simple perl program :

# no buffered output, auto flush
$|=1;

while(<STDIN>)
{
   s#http://something/#http://somthingelse/#;
   print;
}


A bit fast answer, hope that helps.


Regards,
Sylvain.









[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux