When I submit a web form I get "An error occurred while processing your request" along with a long reference number
The error message is very plain and generic looking, and says something like this:
The message reads "An error occurred while processing your request. Reference #125.f3d26068.1531405732.1c8ae6fe". The reference number will vary, and refers to an internal error logging system at Akamai. The error can appear right after you submit a web form hosted on web.mit.edu.
Context
- This error is sometimes encountered when submitting a web form that uses the cgiemail script on web.mit.edu
- In particular, it can occur for a secure web form that requires a personal certificate
- The error does not appear consistently; sometimes it happens, sometimes it does not
Answer
General
Errors of this format are generated by Akamai's content distribution and caching infrastructure. MIT uses Akamai to help us deal with heavy loads and provide more resilient web services. Note that as of June 22, 2018 all web content on web.mit.edu passes through Akamai. Prior to that date, requests from on-campus were still sent directly to web.mit.edu and only off-campus requests were fulfilled through Akamai.
These errors do not occur frequently, but they can appear if a secure web form is mis-configured. If you encounter such an error, please report it to the IS&T Service Desk. If you are the owner/administrator of a web form on web.mit.edu and your users report such an error to you, please see the details below on how to fix your form.
Details
Akamai caches web content. For certificate-protected content that relies on a user submitting a personal web certificate for authentication, the form can sometimes be cached (no certificate needed to pull up the form if the user has authenticated to do so previously). On submit, the request needs to be authenticated to the new endpoint, and a certificate presented. However, if the submit action is done using the POST method, but this renegotiation cannot happen for POST requests, so the submission fails. If the original form was not cached for the user, the authentication is handled when the form is loaded, and the POST request succeeds, so the error can appear only occasionally.
There are several ways to change your form to prevent these errors.
Prevent caching of your web form
- Add the following lines inside the <head>...</head> tags of the HTML file that contains your form:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" />
These lines will prevent caching of the form page.
Change from POST to GET
- Find the action tag in your form, which specifies where and how the form will submit
- You will see the method parameter set to POST; it should look something like this:
<form action="https://web.mit.edu/bin/cgiemail/...path.../form.txt" method="post">
- Change the method from POST to GET; you can either replace the word POST with GET, or remove the entire parameter, since GET is the default
<form action="https://web.mit.edu/bin/cgiemail/...path.../form.txt" method="get">
This change will change your form submission method from POST to GET, and certificates can be validated on a GET request.
Error may appear for other reasons We have only seen this type of error from Akamai for the secure form submission issues described above. However, this is Akamai's general error format, and similar errors could appear if other, unrelated issues are encountered. Remember to grab a copy of the error when you see it, and report it to the IS&T Service Desk as soon as possible, so it can be escalated to Akamai, who will be able to look up the reason for the error based on the reference number. |