perl CGI on IIS url() does not return path

Posted by zvolo on 2007-02-18 21:43

I often use "$q->url();" to obtain my script's full path.
After installing IIS6, above returns only server name, for example
"http://host1". The full path to my cgi script is missing, I am expecting
Btw I have tried $q->url(-full_path=>1) but no go.

Would anyone know how to enable this on IIS6?


JBlaine | Thu, 2008-05-29 08:42

I'm experincing the same issue. I have two servers in an IIS6/NLB cluster. They are running Perl 5.8.2 build 808 and have CGI.PM v3.0-- they work fine (example:

I'm preparing to add a third to the group, and was testing sites. This one is running Perl 5.10.1003, with v3.29. The results for the various query parameters are clearly not as documented, and as a result I'm getting "invalid verb" HTTP errors because by constructed URLs are incomplete. (example of url() results:

Apparently this has been an issue for quite some time... any answers out there?

I see this is posted twice in ActiveState's bug tracking, but neither post has a reply. If it weren't for the documentation, I'd think the parameters got depreciated and I just missed it!


akgreen | Fri, 2010-03-12 18:19

Has there been any further information on why IIS 6 does not return the full path for CGI->URL()? I can find nothing at Microsoft. I discovered this the hard way when a migration from IIS 4 -> 6 caused my app to fail. I am having to write a workaround, but wish there was a MS fix. | Wed, 2010-10-20 15:18

I've just downloaded 5.12, and it seems this is still broken. Similar to jblaine, url() works correctly with our old perl 5.6 install, but this shiny, new 5.12 has the bug. This would be IIS6 on windows 2003 standard edition.

ctarbet | Thu, 2011-06-23 08:58

This is an issue for me on Strawberry Perl as well.

IIS 6.0
Server 2003 Standard SP2

url() returns instead of

derek.r.price@q... | Tue, 2013-01-08 13:13

Also wasn't having a problem with the same code under IIS 5 & Perl 5.6 but after upgrading to Windows 7, IIS 7.5, & ActiveState Perl 5.14.2, $cgi->url() no longer includes the path.

I did find workarounds. Starting with the clue that $cgi->self_url & $cgi->path_info both contain the right values, I found that $cgi->url(-full => 1, -path_info => 1) reproduces the original behavior. Not sure why the default behavior of $cgi->url() changed and $cgi->url(-full => 1) started acting like $cgi->url(-base => 1) used to. docs still describe the original behavior.