maoyuan121 / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

Invalid links in RSS feeds & downloadable CSV log when deployed on AppHarbor #264

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Deploy an application with ELMAH installed on AppHarbor
2. Incude a few errors (e.g. by appending /test to ELMAH's end-point) to fill 
the log a bit
3. Subscribe to the error log RSS feeds or download the error log in CSV format

What is the expected output? What do you see instead?

The URLs to error log in the RSS feed and CSV are unreachable. The problem 
comes from load balanching scheme adding an internal port number as described 
in the following knowledge base article at the AppHarbor support web site:

http://support.appharbor.com/kb/getting-started/workaround-for-generating-absolu
te-urls-without-port-number

Original issue reported on code.google.com by azizatif on 18 Dec 2011 at 5:11

GoogleCodeExporter commented 9 years ago

Original comment by azizatif on 18 Dec 2011 at 5:11

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r909.

Original comment by azizatif on 18 Dec 2011 at 5:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This fix requires adding the publicly reachable URL to the context item under 
the key ELMAH_REQUEST_URL. For AppHarbor, the following code will do the trick 
(assuming for example that ELMAH handler is registered for "errorlog") by 
adding it to Global.asax:

protected void Application_BeginRequest(object sender, EventArgs e)
{
  var context = Context;
  var request = context.Request;
  var path = request.Url.AbsolutePath;
  if (path.IndexOf("/errorlog", StringComparison.OrdinalIgnoreCase) >= 0)
  {
    var portlessUrl = new UriBuilder(request.Url) { Port = -1 }.Uri;
    context.Items["ELMAH_REQUEST_URL"] = portlessUrl;
  }
}

Original comment by azizatif on 18 Dec 2011 at 5:43