I think there was an attempt to correct that by introducing variable CFG->httpswwwroot but that variable is not correctly set or not used everywhere in Moodle code.
I have thought the following solutions
1. Use Apache mod_rewrite to strip :81 from https urls
2. Try setting $CFG->wwwroot to something like "http://".$_SERVER["HTTP_HOST"]."/";
3. Use iptables port redirection so that port 81 is redirected to port 80 and Apache listens on port 80.
4. Modify Moodle code in every page that http:// is replaced with https:// I guess that is a lot of work and I could miss some pages so I will leave that as a last try.
I am currently working on solution 1 but with no luck yet.
I use Moodle 1.9.9, Apache 2.2, PHP 5.1.6, MySQL 5.0 on CentOS Linux 5
I would appreciate any suggestions
