over ssl

Topics: User Forum
Dec 28, 2006 at 1:12 AM
First of all, thanks for making such a great alternative to the commercial products out there. This rewriter has helped me greatly. That being said, there seems to be some problem with using this rewriter over ssl. In the logs, it shows the correct start url, but for some reason the conditions don't match (they do when not using ssl) and all rules evaluate to false. I was thinking that this might have to do with the fact that I'm using the directory and file exists flags with %{REQUEST_FILENAME} in a couple different rules. I noticed you said that this was a special variable you added, and so I'm thinking there might be some problem with it when using ssl. Also, when using ssl the redirect function seems not to be working correctly. Instead of redirecting to https://www.sample.com/sample, it redirects to http://www.sample.com:443/sample which doesn't work in IE. Let me know if I can help you at all in resolving these issues. Thanks again for the rewriter!

Jan 19, 2007 at 4:53 PM
I had the same problem with SSL. Apparently the R redirect option assumes HTTP. This is particularly bad with IIS6, as it adds the port (80 for HTTP, 443 for HTTPS) to the URL. In IIS5 & earlier, you'd simply be redirected to the non-SSL URL (which may or may not work, depending on your configuration). In IIS6, the browser just hangs for a while, having made an HTTP connection to the HTTPS port.

My quick change to the source code (release 1.2.10) solved the problem for me, although I haven't confirmed it works on anything other than IIS6.

Starting at line 400:
else {
char *ServerName= GetServerVariable("SERVER_NAME", pfc);
char *ServerPort= GetServerVariable("SERVER_PORT", pfc);
char *HTTPS= GetServerVariable("HTTPS", pfc); // Modified for SSL
char *Protocol = (_strnicmp(HTTPS,"on",strlen(HTTPS)) ? // Modified for SSL
"http" : "https"); // Modified for SSL

// sprintf_s(buf, sizeof(buf)/sizeof(buf0), "Location: http://%s:%s%s\r\n\r\n",
sprintf_s(buf, sizeof(buf)/sizeof(buf0), "Location: %s://%s:%s%s\r\n\r\n", // Modified for SSL
free(HTTPS); // Modified for SSL

Recompiled with Visual C++ 2005 Express Edition. Hope that's helpful!
Feb 24, 2007 at 2:58 AM
Thanks, very helpful,
I've included that fix into the source for v1.2.11c