Posts

FormMail.pl keeps reporting Bad referrer

I used FormMail.pl from Matt’s Script Archive on one of my web sites and called this script from several other web sites. This way I only need to maintain one copy of the script regarding updates.

The script began complaining about “Bad referrer” when called from my other sites, even though I could positively verify that the other site’s domain name was present in the referrers of FormMail.pl.

Not finding the problem in the script itself I began to think over what I had recently changed on the site hosting the FormMail.pl and one thing was that I recently added a http redirect any incoming calls that didn’t go to the site url using https and I also redirected www.sitename to just sitename. For example, a call to http://www.sitename was redirected to https://sitename using Apache’s http rewrite module.

On my other sites using the FormMail.pl script from the main site, I was calling the FormMail.pl using a url beginning with http://www, i.e. the call was redirected by http redirect rules. When changing the url to call the FormMail.pl script to https://sitename (i.e. using SSL and no www), the call would not be touched by http redirect rules and voila – everything was working again.

Error message in Apache log file: “Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden”

The error message "Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden" occured in my Apache logfile and the visitor was displayed an error 403 forbidden error page when trying to access a cgi-script written in Perl. The solution was to add the following for the directory in question to my Apache configuration file: 

<Directory /var/www/cgi-bin>
  <Files ~ (\.pl)>
  Options ExecCGI FollowSymLinks
  </Files>
  Options +FollowSymLinks +SymLinksIfOwnerMatch
</Directory>