Re: [squid-users] Need 413 status code when reply_body_max_size is hit

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 14 Mar 2012 14:45:34 +1300

On 14.03.2012 04:50, squid-list wrote:
> I limit the maximum file size an employee can download to our network
> using
> reply_body_max_size 100 MB proxy_user1. If this limit is hit, Squid
> returns a
> 403.
>
> My problem is that I would like to differentiate between the status
> code 403
> that comes from a target website that does not allow access at all to
> download
> a specific file and to the intentional 403 that is generated from
> Squid
> because the file size exceeds the limit we set.
>
> The reason is that I want to display the user a message like "The
> target
> website does not allow access" and "You have requested a file to
> download that
> is too large. Please contact the IT department". I was thinking that
> the 413
> is useful for that.

Apart from the minor detail that 413 applies only to *request* size.
Client software can get confused if the zero-length *request* body on a
GET is "too big" for example. Yes, I have looked into this.

>
> Is there a way to change the status code/message when a user hits the
> reply_body_max_size and differentiate that case? Is there any other
> workaround?

If your Squid is new enough (3.2 beta) you can use deny_info to set the
status code delivered.

I recommend picking some high unused number for this. 49x or such until
somebody writes up a IETF specification for this type of usage and
allocates a code.

Amos
Received on Wed Mar 14 2012 - 01:45:38 MDT

This archive was generated by hypermail 2.2.0 : Wed Mar 14 2012 - 12:00:03 MDT