mwrock/RequestReduce

RR behind ssl accelerator

Opened this issue · 1 comments

Hi,

First - thanks for the excellent library.

I am trying to use RR behind a SSL accelerator which offloads SSL work to the ssl appliance and only http request reaches the web server. The urls emitted and rendered in html still need to be https.
There is no mix (as logged in another issue) - all traffic is https.

Since the host name (on SSL appliance) does not listens on port 80, RR is unable to fetch js files from the server thru http for minification.

Here is the error summary:

First errored on: 11/15/2012 5:51:32 PM
Number: 1
Exception #1: There were errors reducing http://sslhost.mydomain.com/MyApp/Scripts/libs/jquery-1.7.1.min.js::htt...
Exception #2: RequestReduce had problems accessing http://sslhost.mydomain.com/MyApp/Scripts/libs/jquery-1.7.1.min.js. Error Message from WebClient is: Unable to connect to the remote server
Stack Trace#2:
at RequestReduce.Utilities.WebClientWrapper.Download(String url, IEnumerable1 requiredMimeTypes) in c:\RequestReduce\RequestReduce\Utilities\WebClientWrapper.cs:line 85 at RequestReduce.Utilities.WebClientWrapper.Download[T](String url) in c:\RequestReduce\RequestReduce\Utilities\WebClientWrapper.cs:line 35 at RequestReduce.Reducer.JavaScriptReducer.ProcessJavaScript(String url) in c:\RequestReduce\RequestReduce\Reducer\JavaScriptReducer.cs:line 56 at RequestReduce.Reducer.JavaScriptReducer.ProcessResource(Guid key, IEnumerable1 urls, String host) in c:\RequestReduce\RequestReduce\Reducer\JavaScriptReducer.cs:line 32
at RequestReduce.Reducer.HeadResourceReducerBase`1.Process(Guid key, String urls, String host) in c:\RequestReduce\RequestReduce\Reducer\HeadResourceReducerBase.cs:line 37
at RequestReduce.Module.ReducingQueue.ProcessQueuedItem() in c:\RequestReduce\RequestReduce\Module\ReducingQueue.cs:line 162

Exception #3: Unable to connect to the remote server
Stack Trace#3:

at System.Net.HttpWebRequest.GetResponse()
at RequestReduce.Utilities.WebClientWrapper.Download(String url, IEnumerable`1 requiredMimeTypes) in c:\RequestReduce\RequestReduce\Utilities\WebClientWrapper.cs:line 62

Exception #4: No connection could be made because the target machine actively refused it 192.168.1.20:80
Stack Trace#4:

at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)

I ran into a similar issue using Nginx in front of an iis farm of web servers (nginx was doing ssl offloading and acting as reverse proxy).

The problem is that you are creating a loop, where RR actually hits the SSL accelerator to fetch the content. The workaround for this are:

  1. You could create an additional virtual host name in IIS (local.yoursite.com) and change all the urls in your site for css / js to point to that.
  2. The easier approach is to edit your IIS machines hosts file and ad a 127.0.0.1 entry to your domain. That way when RR looks for the file, it will hit your dns (hosts file) and pull the file from the server running IIS instead of the SSL accelerattor.