"500 Internal Server Error" while adding questions

"500 Internal Server Error" while adding questions

by Yogesh Nahar -
Number of replies: 23

Hello Fellow Moodlers,

I am having an issue with adding questions to the quiz question bank one after the other. I can add one question and then when I try to add the next question I get a "500 Internal Server Error: The request was rejected by the HTTP filter".

I do understand that this was an issue before: http://tracker.moodle.org/browse/MDL-12156 and had been resolved with this change in the ISA server: http://www.tomrafteryit.net/isa-server-error-12217/ .

This is the URL when adding the 1st question successfully: http://domain/moodle/question/question.php?category=101&cmid=6474&returnurl=http%3A%2F%2Fdomain.org%2Fmoodle%2Fmod%2Fquiz%2Fedit.php%3Fcmid%3D6474&qtype=multichoice

This is the URL when trying to add the 2nd question: http://domain.org/moodle/question/question.php?category=101&cmid=6474&returnurl=http%3A%2F%2Fdomain.org%2Fmoodle%2Fmod%2Fquiz%2Fedit.php%3Fqpage%3D0%26amp%3Bcat%3D101%252C9844%26amp%3Bcmid%3D6474&qtype=multichoice

But I am still facing the issue even after applying the suggested change to the ISA server. Any assistance on this issue is greatly apprecaited. Thank you.

Yogi

Average of ratings: -
In reply to Yogesh Nahar

Re: "500 Internal Server Error" while adding questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Weird. Can you get a longer error message than "Error: The request was rejected by the HTTP filter" Perhaps from some log file. It would be nice to find out more about exactly what the HTTP filter is rejecting and why.

In reply to Tim Hunt

Re: "500 Internal Server Error" while adding questions

by Yogesh Nahar -

I found these messages in the error logs:

[Thu Oct 14 14:21:43 2010] [error] [client IP address] File does not exist: D:/xampp/htdocs/moodle/theme/aardvark_beta/styles_print.css, referer: http://domain.org/moodle/mod/quiz/index.php?id=93
[Thu Oct 14 14:21:46 2010] [error] [client IP address] File does not exist: D:/xampp/htdocs/moodle/theme/aardvark_beta/styles_print.css, referer: http://domain.org/moodle/mod/quiz/edit.php?cmid=6474
[Thu Oct 14 14:21:50 2010] [error] [client IP address] File does not exist: D:/xampp/htdocs/moodle/theme/aardvark_beta/styles_print.css, referer: http://domain.org/moodle/question/question.php?category=101&cmid=6474&returnurl=http%3A%2F%2Fe-learn.crouse.org%2Fmoodle%2Fmod%2Fquiz%2Fedit.php%3Fcmid%3D6474&qtype=multichoice
[Thu Oct 14 14:22:07 2010] [error] [client IP address] File does not exist: D:/xampp/htdocs/moodle/theme/aardvark_beta/styles_print.css, referer: http://domain.org/moodle/mod/quiz/edit.php?lastchanged=411&category=101%2C9844&cmid=6474

I am clueless as to why the CSS stylesheet would have to do anything with this issue or am I missing something here?

In reply to Yogesh Nahar

Re: "500 Internal Server Error" while adding questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Missing stylesheet is completely unrelated.

In reply to Yogesh Nahar

Re: "500 Internal Server Error" while adding questions

by Colin Fraser -
Picture of Documentation writers Picture of Testers

As Tim says, the style sheet is not related, but your error message suggests that you are using a Xampp shell for Moodle. By the looks of it, you have set up a Xampp server into which you have installed a Moodle, rather than a  Xampp-lite/Moodle, as you can download from Moodle.org. If I am right, then the issue will lie in the shell rather than Moodle. I have tried the Xampp shell and the Xampp-lite/Moodle and just every now and again, it tosses in an error of unknown origin and indeterminate resolution. I have no idea why, but it just does it, maybe it is a full moon or something in gravity's permutations in that exact spot in the world, who knows. This means that something out of left field is going to fix it, which means a lot of experimentation to hit the right combination of things to get it fixed.

Recomendation, install a Xampp-free server and migrate everything to it. This is a lot easier said than done though, even if everything goes right.

If I am reading this wrong, and you have a Xampp-lite/Moodle install, then go and look at these videos and drop the Xampp.

Either way, your problem will be fixed.

 

 

 

 

In reply to Colin Fraser

Re: "500 Internal Server Error" while adding questions

by Mauno Korpelainen -

In my opinion this is simply a bug in question.php and the way how it uses returnurl in paths.

If you save one multiple choice question and try to edit it and save the same question again you get a similar non-existing path. I tried it on my local XAMPP, Debian Lenny on my test site and on http://qa.moodle.net

http://qa.moodle.net/question/question.php?returnurl=http%3A%2F%2Fqa.moodle.net%2Fmod%2Fquiz%2Fedit.php%3Fcmid%3D60%26amp%3Bcat%3D8%252C78%26amp%3Bqpage%3D0&cmid=60&id=5

leads to impossible path

http://qa.moodle.net/http://qa.moodle.net/mod/quiz/edit.php?cmid=60&cat=8%2C78&qpage=0&category=8%2C78&lastchanged=5

No need to install XAMPP-Lite for this bug...

In reply to Mauno Korpelainen

Re: "500 Internal Server Error" while adding questions

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Well... since I dropped the Xampp shell, I have not had a similar problem, but then it only happened once and I was already considering dropping Xampp. In a quiz was getting an error, thought it was me at first, wondering if I was doing something wrong, admittedly I cannot recall what I was doing, but then I was no longer interested in using Xampp so did not really pay attention. Swapped out and happy ever since...big grin

In reply to Mauno Korpelainen

Re: "500 Internal Server Error" while adding questions

by Yogesh Nahar -

I tried to look at the question.php file but couldn't figure out what the issue might be. Would it be possible for you to take a look at it if you have some time?

Thanks.

In reply to Yogesh Nahar

Re: "500 Internal Server Error" while adding questions

by Mauno Korpelainen -

And in fact Tim had made several tiny fixes to files in CVS so upgrading to the latest version of moodle 2 is the best choice. The main bug was in http://tracker.moodle.org/browse/MDL-24453

In reply to Mauno Korpelainen

Re: "500 Internal Server Error" while adding questions

by Rob Monk -

Error Code: 500 Internal Server Error. The request was rejected by the HTTP filter. Contact the server administrator. (12217)

I get this error when I try to edit or add quiz questions from outside our schools system. When I work within our DMZ it works fine. Any suggestions to fix it.

In reply to Rob Monk

Re: "500 Internal Server Error" while adding questions

by Jeremy Corey-Gruenes -

I am having the same exact problem as Rob. I am just a teacher, not a network administrator, so my understanding of all of this pretty basic. I'd love to be able to send something to our network guru to help him solve this for me. Again, the problem only exiss when I try to edit or add questions from outside the school system. Within it, I'm fine.

In reply to Jeremy Corey-Gruenes

Re: "500 Internal Server Error" while adding questions

by Rob Monk -

Sometimes I can actually help solve a problem rather than just report them.

This error is not at moodle problem but an ISA server problem. Here is the solution. You need your Techie guy (or girl) to do this as I don't understand any of it. My Techie guy did it and it solved my problem.

Error Code: 500 Internal Server Error. The request was rejected by the HTTP filter. Contact the server administrator (12217)

Applies To
MachPanel all versions
ISA Server

Solution
On investigation it was found that the problem occurs upon accessing the URL in an environment controlled by ISA server. The ISA HTTP filter blocks the connection causing the error.

To solve this problem please do the following on ISA Server:

  1. Edit the publishing rule.
  2. Go to traffic tab
  3. Click the filtering button
  4. Select configure HTTP and then un-check Verify Normalisation.


Once the configuration is applied everything will work as expected.

Average of ratings: Useful (1)
In reply to Yogesh Nahar

Re: "500 Internal Server Error" while adding questions

by Jeremy FitzPatrick -
Picture of Plugin developers

An observation that may be of interest that I noticed trying to find the cause/solution to this issue on our Moodle 2.1 server.

The category attribute of the query string in question/edit.php (the page that calls the problem page question/question.php)  includes %2C (,) e.g. category=38%2C201. This is further encoded in the query string in question/question.php to %252C e.g. cat%3D38%252C20. When I manually replace the %25 in this part of the query string with its corresponding character % the page actually loads fine.

So while the problem may be specific to IIS and fixed with a change to the IIS settings, I suggest that a fix could also be implemented in the code. Further investigation is required of course.

Average of ratings: Useful (1)
In reply to Jeremy FitzPatrick

Re: "500 Internal Server Error" while adding questions

by Michael Lewis -
I'm also seeing this error with Moodle 2.2.3, IIS, MSSQL, the server sitting behind an ISA gateway. I can't justify requesting the systems team turn off verify normalization as that opens potential security holes. I'm also sure that if it were agreed to, it would take a long time going through approval and QA testing. I had also noticed the "encoded comma" after "cat=" and I'm unsure what the reason is to be referring to (what appear to be) two category IDs in the URL?
In reply to Michael Lewis

Re: "500 Internal Server Error" while adding questions

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

category=38%2C201 is valid URL that is equivalent to category=38,201. (It is actually a contextid and a categoryid, not two contextids.)

If ISS cannot cope with that, why don't you take it up with Microsoft?

In reply to Tim Hunt

Re: "500 Internal Server Error" while adding questions

by Michael Lewis -

Tim,

Thanks for explaining the contextid,categoryid in the URL. I also found your answer from 4 years ago which explains why there is sometimes double encoding - http://moodle.org/mod/forum/discuss.php?d=93513#p413057.

I will see if our network admins can be persuaded to turn off the ISA verify normalisation feature.

In reply to Michael Lewis

Re: "500 Internal Server Error" while adding questions

by Adam H -

Does anyone have any more feedback on this one?


This error has effected two Moodle installations I deal with.. The first one was fixed by verifying normalisation in ISA..

The second instance is not behind ISA server and we're getting 500 http error when we add a question to quiz which was migrated from a 1.9 instance of moodle.

Moodle is trying to redirect to http://vle.college.ac.uk/moodle/question/question.php?returnurl=%2Fmod%2Fquiz%2Fedit.php%3Fcmid%3D48839%26cat%3D571%252C48298%26qpage%3D0&cmid=48839&category=571&qtype=description  --- This does not work and gives a 500 error

http://vle.college.ac.uk/moodle/question/question.php?returnurl=%2Fmod%2Fquiz%2Fedit.php%3Fcmid%3D48839%26cat%3D571%2C48298%26qpage%3D0&cmid=48839&category=571&qtype=description --- this however does work..

Which code should I modify to make the URL return like the one above..

I've looked in question/edit.php and question.php and see lots of references to $originalreturnurl and $returnurl, but i'm unsure of which lines I need to be looking at mixed


Regards

Adam

In reply to Adam H

Re: "500 Internal Server Error" while adding questions

by Adam H -

Just a little bit more background on my problem.. This is happening on an Apache server..

For whatever reason the %252C is a double encoded 'comma' symbol.. The single encoded %2C works fine.. Where in the code can I change the return URL to single encoding? Or could I turn on a directive in Apache to allow double encoding in URL's?

In reply to Adam H

Re: "500 Internal Server Error" while adding questions

by Adam H -

Also forgot to mention that this is only happening when adding a question to a question bank which has been migrated from Moodle 1.9..

Creating a new quiz and adding questions to a question bank works fine.

In reply to Adam H

Re: "500 Internal Server Error" while adding questions

by Phil Everist -

I have just started seeing this error ocurring in our ISA server MS SQL environment every time a second quiz question is added to the question bank  (happens bothin our Moodle 2.3 Live system and our Moodle 2.4 Test system). Returning to the course then back to the question bank avoids the issue (as I guess uploading would also) but it's pretty annoying for the edcuators. 

The recent change applied to both systems I think has caused this issue was changing from internal addressing to an external https external addressing so the system can be accessed from outside the firewall though our Threat Management Gateway as well when logged on to a system computer within the network. The $CFG->wwwroot was changed to the external access. Everthing seems to be working fine except the second addition of a questions to the question bank. 

The first initial URL that works is:
https://theo.test.dhhs.tas.gov.au/question/question.php?returnurl=%2Fquestion%2Fedit.php%3Fcourseid%3D145&courseid=145&category=62&qtype=multichoice

The second URL that gives the 500 error is:
https://theo.test.dhhs.tas.gov.au/question/question.php?returnurl=%2Fquestion%2Fedit.php%3Fcourseid%3D145%26cat%3D62%252C20529%26qpage%3D0&courseid=145&category=62&qtype=multichoice

 Any suggestions on what we need to do to fix this?

thanks

Phil  

In reply to Phil Everist

Re: "500 Internal Server Error" while adding questions

by Phil Everist -

HI  - in update to my post above, our IT team did decide they could apply the Verify Normalistion fix:

1.Edit the publishing rule.
2.Go to traffic tab
3.Click the filtering button
4.Select configure HTTP and then un-check Verify Normalisation. 

All seems to be working now.

Average of ratings: Useful (1)