void app_BeginRequest(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; string proxyAddress = GetProxySiteAddress(app); if( string.IsNullOrEmpty(proxyAddress) ) return; string destAddress = proxyAddress + app.Request.RawUrl; app.Context.Items[ProxyTransferHandler.TargetUrlKeyName] = destAddress; IHttpHandler hander = new ProxyTransferHandler(); app.Context.RemapHandler(hander); app.Context.Response.Headers.Add("x-ReverseProxyModule", destAddress); // 用于调试诊断 }
void app_BeginRequest(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; string proxyAddress = GetProxySiteAddress(app); if (string.IsNullOrEmpty(proxyAddress)) { return; } string destAddress = proxyAddress + app.Request.RawUrl; app.Context.Items[ProxyTransferHandler.TargetUrlKeyName] = destAddress; IHttpHandler hander = new ProxyTransferHandler(); app.Context.RemapHandler(hander); app.Context.Response.Headers.Add("x-ReverseProxyModule", destAddress); // 用于调试诊断 }