mwrock / RequestReduce

Instantly makes your .net website faster by reducing the number and size of requests with almost no effort.
www.requestreduce.org
Apache License 2.0
228 stars 49 forks source link

RequestReduce having issues with Umbraco backoffice #270

Open ybhatti opened 8 years ago

ybhatti commented 8 years ago

I have a site that uses Umbraco. The site renders as expected with Request Reduce. However the Umbraco back office renders incorrectly (more than one <!DOCTYPE html> and head in page etc...) I nice way to get around this issue would be to ignore the Umbraco back office pages for Request Reduce Is there anyway to configure RequestReduce to ignore the Umbraco back office? I tried the "javascriptUrlsToIgnore" property by setting it to "/umbraco/" but that didn't work

srmooney commented 8 years ago

I had a similar issue, but it was with another part of the site. I was able to ignore certain urls using the PageFilter API on the url path with the following code (VB.net):

Namespace WSC
    Public Class StartupModule
        Implements IHttpModule

        Private Shared _lockObj As New Object()
        Private Shared _ran As Boolean = False

        Public Sub Dispose() Implements IHttpModule.Dispose
        End Sub

        Public Sub Init(context As HttpApplication) Implements IHttpModule.Init
            '-- lock
            If Not _ran Then
                SyncLock _lockObj
                    If Not _ran Then
                        ' everything we do here is blocking
                        ' on application start, so we should be quick. 
                        RequestReduce.Api.Registry.AddFilter(New RequestReduce.Api.PageFilter(Function(x) Not x.HttpRequest.Url.Host.Contains("/specsheet.aspx")))
                        _ran = True
                    End If
                End SyncLock
            End If
        End Sub
    End Class
End Namespace