Search squid archive

Re: One more question on redirects - hopefully more clear

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

 



BJ Tiemessen wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You said (in a different thread) you are using squid 2.6 so I am pretty
sure you should be using url_rewrite_program instead of redirect_program.

James Wenzel wrote:
| Hello,
|
|   Ok I have moved from squirm to a perl redirect. My squid.conf looks
| like this
|
| ....top stuff removed ....
| redirect_program /usr/local/squid/etc/redirector
| redirect_children 10

url_rewrite_program /usr/local/squid/etc/redirector
url_rewrite_children 10

| visible_hostname MYSITE
| http_port 8001 accel defaultsite=www.mysite.com:8001
| cache_peer 10.1.140.202 parent 8001 0 no-query originserver name=auth
|
| My redirector looks like this
|
| #!/usr/bin/perl
| $|=1;
| while (<>) {
I needed all the parts coming in...
($url, $addr, $fqdn, $ident, $method) = m:(\S*) (\S*)/(\S*) (\S*)
(\S*)(\s+\S*)?:;

Try using the 302 redirect it has been a while since I wrote my
redirector but I think for some reason I needed to use the redirect.

Agreed. 302 should be the way to go. It covers all the other bases of things which might need re-writing to match the URL.

The default path '/' is still your problem here though. At least one of them is supposed to always be sent in HTTP URL.

To handle that in your pattern check for an optional / at the end of the incoming request. Include it in the part to be replaced.

I say optional / because Some browsers are broken and neglect to send them.



$url = '302:http://www.mysite.com:8001/OA_HTML/US/ICXINDEX_BOL.htm'
if($url =~ @http://www.mysite.com:8001@);
print $url;
|
|
s@http://www.mysite.com:8001@http://www.mysite.com:8001/OA_HTML/US/ICXINDEX_BOL.htm@;
or just do:
s@http://www.mysite.com:8001@302:http://www.mysite.com:8001/OA_HTML/US/ICXINDEX_BOL.htm@;
|
|     print;
| }
|
|
| when I start up squid and go to
|
| http://mysite.com:8001 I get
|
| Not Found
| The requested URL /OA_HTML/US/ICXINDEX_BOL.htm/ was not found on this
| server.
|
| in the browser. and
|
| TCP_MISS/404 484 GET http://www.mysite.com:8001/ - FIRST_UP_PARENT/auth
| text/html
|
| Please tell me what I am doing wrong.
|
| Jamie
|

Amos
--
Please use Squid 2.6.STABLE20 or 3.0.STABLE5

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

  Powered by Linux