Edmonds Commerce Logo
  • home
    • blog
  • ecommerce
    • product catalogue
    • order processing
    • customer services
    • stock control
    • human resources
    • management information
  • development
    • oscommerce
    • php
    • mysql
    • open source
    • performance tuning
  • design
  • marketing
  • contact us
    • pricing

Edmonds Commerce Blog

Freelance PHP Ecommerce and SEO Developer in the UK

Latest Posts

Magento Most Popular Extensions
Google Chrome for Linux Beta
Firefox Address Bar Lag + Solution
Custom Buttons for Firefox

Most Popular Posts

Magento Developer UK Freelance osCommerce UK Magento Training CRE Loaded UK

Google Checkout, 501 Error with Mod Security + Solution

March 26th, 2009
Read More security

If you are pulling your hair out trying to figure out why you are seeing a 501 error in your Google Checkout integration console I may well have the answer and solution for you.

This is the error message you will see in the integration console.

PLAIN TEXT
CODE:
  1. We encountered an error trying to access your server at https://domain.co.uk/googlecheckout/api/ -- the error we got is Sending failed with HTTP response code: 501. Response body was: <HTML> <HEAD> <TITLE>501 Not Implemented</TITLE> </HEAD> <BODY> <H1>Not Implemented</H1> The page you are looking for cannot be displayed because a header value in the request does not match certain configuration settings on the Web server.<P> <HR> <ADDRESS> Web Server at domain.co.uk </ADDRESS> </BODY> </HTML> <!-- - Unfortunately, Microsoft has added a clever new - "feature" to Internet Explorer. If the text of - an error's message is "too small", specifically - less than 512 bytes, Internet Explorer returns - its own error message. You can turn that off, - but it's pretty tricky to find switch called - "smart error messages". That means, of course, - that short error messages are censored by default. - IIS always returns error messages that are long - enough to make Internet Explorer happy. The - workaround is pretty simple: pad the error - message with a big comment like this to push it - over the five hundred and twelve bytes minimum. - Of course, that's exactly what you're reading - right now. -->

The first thing to do is log into your server via SSH and examine the error logs.

find the error logs, open the file up in vi using this command:

PLAIN TEXT
CODE:
  1. vi error_log

Then go to the bottom of the file using the [shift] + [g] shortcut. Then to search backwards in the log use the following command:

PLAIN TEXT
CODE:
  1. ?ModSecurity

If you find something with this error message then you have mod security installed. If you search around you may well find an error message like this:

[Thu Mar 26 10:22:11 2009] [error] [client 94.229.166.12] ModSecurity: Access denied with code 501 (phase 2). Match of "rx (?:^(?:application\\/x-www-form-urlencoded(?:;(?:\\s?charset\\s?=\\s?[\\w\\d\\-]{1,18})?)??$|multipart/form-data;)|text/xml)" against "REQUEST_HEADERS:Content-Type" required. [file "/etc/httpd/modsecurity.d/modsecurity_crs_30_http_policy.conf"] [line "71"] [id "960010"] [msg "Request content type is not allowed by policy"] [severity "WARNING"] [tag "POLICY/ENCODING_NOT_ALLOWED"] [hostname "247electrical.co.uk"] [uri "/googlecheckout/api"] [unique_id "-UMIen8AAAEAAFsDLH4AAAAB"]

This error message tells us which particular rule is causing it to fail. What we need to do now is either edit this rule or disable it altogether. I will first try to edit it so that the request can get through, but the rule is still active. The rule we need to edit is in this rules file:

modsecurity_crs_30_http_policy.conf

and is on line 71.

I'm no mod security expert. Having had a quick look through the documentation I am not sure how to edit this rule to allow Google Checkout callbacks through. So for the time being I am going to disable this particular rule altogether by adding a # in front of lines 70,71 and 72.

If any mod security experts out there read this blog and know a better solution please do post it in the comments.

More...

Online SSL Checker (Google Checkout) | Edmonds Commerce Blog
Visionspecialists introduces Google Checkout and a brand new line ...
Google Checkout and Nonprofits | FormSpring Blog
Visionspecialists introduces Google Checkout and a brand new line ...
Google Checkout and Nonprofits | FormSpring Blog
NoVirusThanks Blog » ModSecurity v2.5.9 Released (fixed a ...
maxgarrick.com » 8 ModSecurity Tips for a Successful Roll-out
What should we do when web protection mechanisms fail? | N-Stalker ...
NoVirusThanks Blog » ModSecurity 2.5.7 for Apache Web Server
NoVirusThanks Blog » ModSecurity v2.5.9 Released (fixed a ...
maxgarrick.com » 8 ModSecurity Tips for a Successful Roll-out
NoVirusThanks Blog » ModSecurity 2.5.7 for Apache Web Server
Apache: Configuring mod_security (modsecurity) for Apache on Fedora.
admin.jugamanusia.com » Mod_Security.. what is and how to ?

Possibly Relevant Posts:

  • Plesk + Mod Security
  • Online SSL Checker (Google Checkout)

Feed | Respond | Trackback

2 Responses to “Google Checkout, 501 Error with Mod Security + Solution”

  1. Victor Julien Says:
    March 26th, 2009 at 12:58 pm

    You can also disable a rule for a specific location like this:

    PLAIN TEXT
    CODE:
    1. <LocationMatch "/googlecheckout/api">
    2.     SecRuleRemoveById 960010
    3. </LocationMatch>

    The nice thing about it is that you can put this in a separate file (disabled.conf for example) so you don't have to redo the change to the rules file every time you update it...

  2. admin Says:
    March 26th, 2009 at 1:21 pm

    this is a much better solution as it only disabled the rule at the point we need to disable it, but will keep the rule active everywhere else..

    cheers Victor :)

Leave a Reply

  • RSS Feed
  • Categories

    • adwords
    • apache
    • barcode
    • business
    • creloaded
    • css
    • curl
    • customer services
    • debugging
    • drupal
    • eclipse
    • ecommerce
    • edmondscommerce
    • email
    • excel
    • firefox
    • flash
    • gd
    • git
    • graphs
    • hosting
    • icecat
    • internet news
    • javascript
    • jquery
    • link building
    • linux
    • mac
    • magento
    • management
    • misc
    • mod_rewrite
    • mysql
    • netbeans
    • open suse
    • oscommerce
    • php
    • plesk
    • portfolio
    • product catalogue
    • product feed
    • programming
    • regular expressions
    • ria
    • scraping
    • search engine optimisation
    • security
    • seo
    • spidering
    • symfony
    • twitter
    • ubuntu
    • Uncategorized
    • usability
    • vps
    • web design
    • web development
    • Windows
    • xampp
    • zend framework
    • zip
  • Archives

    • February 2010
    • January 2010
    • December 2009
    • November 2009
    • October 2009
    • September 2009
    • August 2009
    • July 2009
    • June 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
  • Tags

    bulk course cre loaded creloaded css custom developer development directories drupal error find firefox git google hosts file html jaunty javascript leeds links linux magento mysql netbeans oscommerce performance php plesk ppc problem replace search engine optimisation seo server symfony table training ubuntu uk virtualbox web web design xml zend framework
  • Random Posts

    • Favourite Ubuntu Music Player
    • Magento Newsletters Not Sending + Solution
    • Web Developer Toolbar for Firefox
    • 2147483647 Error
    • Suse Home Folder Problems
    • Speed Up Gmail - Solution
    • File Comparison on Ubuntu
    • Google Checkout Integration Tools
    • Populating osCommerce and other Ecommerce Platforms
    • Checking Product Coverage with the ICEcat system.
  • Recent Comments

    • admin on Magento Backup Error Filesystem.php on line 234 + Solution
    • admin on Magento Leeds
    • Matthew Dolley on Magento Leeds
    • kash on PHP Email Attachment Function
    • Hussein on PHP Save Images Using cURL
  • Category Specific RSS

    • adwords Feed for all posts filed under adwords
    • apache Feed for all posts filed under apache
    • barcode Feed for all posts filed under barcode
    • business Feed for all posts filed under business
    • creloaded Feed for all posts filed under creloaded
    • css Feed for all posts filed under css
    • curl Feed for all posts filed under curl
    • customer services Feed for all posts filed under customer services
    • debugging Feed for all posts filed under debugging
    • drupal Feed for all posts filed under drupal
    • eclipse Feed for all posts filed under eclipse
    • ecommerce Feed for all posts filed under ecommerce
    • edmondscommerce Feed for all posts filed under edmondscommerce
    • email Feed for all posts filed under email
    • excel Feed for all posts filed under excel
    • firefox Feed for all posts filed under firefox
    • flash Feed for all posts filed under flash
    • gd Feed for all posts filed under gd
    • git Feed for all posts filed under git
    • graphs Feed for all posts filed under graphs
    • hosting Feed for all posts filed under hosting
    • icecat Feed for all posts filed under icecat
    • internet news Feed for all posts filed under internet news
    • javascript Feed for all posts filed under javascript
    • jquery Feed for all posts filed under jquery
    • link building Feed for all posts filed under link building
    • linux Feed for all posts filed under linux
    • mac Feed for all posts filed under mac
    • magento Feed for all posts filed under magento
    • management Feed for all posts filed under management
    • misc Feed for all posts filed under misc
    • mod_rewrite Feed for all posts filed under mod_rewrite
    • mysql Feed for all posts filed under mysql
    • netbeans Feed for all posts filed under netbeans
    • open suse Feed for all posts filed under open suse
    • oscommerce Feed for all posts filed under oscommerce
    • php Feed for all posts filed under php
    • plesk Feed for all posts filed under plesk
    • portfolio Feed for all posts filed under portfolio
    • product catalogue Feed for all posts filed under product catalogue
    • product feed Feed for all posts filed under product feed
    • programming Feed for all posts filed under programming
    • regular expressions Feed for all posts filed under regular expressions
    • ria Feed for all posts filed under ria
    • scraping Feed for all posts filed under scraping
    • search engine optimisation Feed for all posts filed under search engine optimisation
    • security Feed for all posts filed under security
    • seo Feed for all posts filed under seo
    • spidering Feed for all posts filed under spidering
    • symfony Feed for all posts filed under symfony
    • twitter Feed for all posts filed under twitter
    • ubuntu Feed for all posts filed under ubuntu
    • Uncategorized Feed for all posts filed under Uncategorized
    • usability Feed for all posts filed under usability
    • vps Feed for all posts filed under vps
    • web design Feed for all posts filed under web design
    • web development Feed for all posts filed under web development
    • Windows Feed for all posts filed under Windows
    • xampp Feed for all posts filed under xampp
    • zend framework Feed for all posts filed under zend framework
    • zip Feed for all posts filed under zip

Edmonds Commerce related questions? Send us a message or call us on 0844 357 0201.

Freelance PHP Web Design UK Commercial Web Design