ColdFusion 8, 'Post Size Exceeds The Maximum Limit'

I want to change the 500 error message but I cannot find it. Any help as to where this message is stored so I can edit it will solve this issue:

"ROOT CAUSE:
coldfusion.filter.RequestThrottleFilter$PostSizeLimitExceededException: Post Size exceeds the maximum limit."

Strangely, CF8 using CFFILE does not seem to have ANY way to limit the size or type of file until the file is actually uploaded. On an open page to the public as we have, anyone can attempt to upload a huge file of any time and will only be stopped once the file is uploaded and only then does CF seem to be smart enough to actually do something.

But just as strange, a setting in CF Admin does allow a limit on the upload, or at least, "post data".

The reason is that I set the maximum file size in CF Admin for "Maximum size of post data" to 20 MB so that using CFFILE UPLOAD, a person could not tag a large file upload to cause needless drag and upload from a person just playing around.

The setting in CF Admin seems to work and so what I want but the error message itself is pretty ugly and I wanted to see if I could help make it a bit more user friendly.  However, I cannot seem to find that error message anywhere to change it and CFTRY/CFCATCH does not seem to catch it.
Grover McBroomAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

_agx_Commented:
I'm not running CF8 anymore,  but it's probably implemented the same way as in CF10. In CF10 that error message isn't stored anywhere.  Nor can it be trapped with cftry/cfcatch. The reason is the actual file uploading is handled by a CF servlet (not CFFILE).  The handing occurs behind the scenes, before any of your CF code ever executes.  That means the error is thrown before your code ever executes. That is why you cannot trap it with cfcatch OR Application.onError.  

EDIT:   AFAIK, the only way to handle it is by using a custom error page. (Try a site wide error handler page first, though it probably won't work because it is triggered before any CF code runs.)  In CF10 you have to set a custom error page in WEB-INF/web.xml to trap this kind of error.  CF10 uses Tomcat, but here are the instructions for JRUN (used by CF8);

              http://web.archive.org/web/20130811171708/http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet12.htm

You'll need to experiment to determine if you can use <exception-type> or need to use a generic <error-code>.  All depends on how CF8 throws the error ...

Strangely, CF8 using CFFILE does not seem to have ANY way to limit the size or type of file until the file is actually uploaded.

Unfortunately action=upload was a poor naming choice. CFFILE doesn't actually upload files.  That is already completed when CFFILE executes.  The tag only moves and renames files that are already uploaded onto the server.
Grover McBroomAuthor Commented:
I found web.xml file but lots of unknowns here. Not sure which to chose on  that link you suggested.

As an example, what would be the text placed inside the "exception type"?

Obviously "java.io.FileNotFoundException" won't due.

<exception-type>java.io.FileNotFoundException</exception-type>

Or would that be the choice? Kind of stumped here.  Maybe I had just better leave it as it is.
David Johnson, CD, MVPOwnerCommented:
500 error message you would have to go into the custom errors section of the applicable web server apache/iis and change the error message displayed there.
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

_agx_Commented:
EDIT:

@Grover McBroom - Honestly I'm not sure.  I had to do some testing w/CF10 to find the correct settings for the specific POST error I was trying to trap.  It all depends on how CF is throwing the error.   I'd have to see the full error message and trace from the logs to know if you'll be able to trap that specific type - or will need to use the more generic HTTP 500 error code.

Based on what you posted try using the PostSizeLimitExceededException. You may need to restart to apply the changes:
<error-page>
<exception-type>coldfusion.filter.RequestThrottleFilter$PostSizeLimitExceededException</exception-type>
    <location>/path/to/yourCustomPage.cfm</location>
</error-page>

Open in new window


If that doesn't work, a general 500 error code willdefinitely work.

<error-page>
    <error-code>500</error-code>
    <location>/path/to/yourCustomPage.cfm</location>
</error-page>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Grover McBroomAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for Grover McBroom's comment #a40878566

for the following reason:

Sorry forgot to close this one. Thanks!
Grover McBroomAuthor Commented:
Sorry, though this was closed. I tried again and submitted it but it never closed again. Will try again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.