Skip to content

Commit

Permalink
Made sure that localhost is not user as servername to prevent AJAX re…
Browse files Browse the repository at this point in the history
…quests from failing.
  • Loading branch information
gauffininteractive committed Feb 16, 2017
1 parent 36a8e20 commit c806f29
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Expand Up @@ -42,10 +42,10 @@ public async Task HandleAsync(ReportAddedToIncident e)
if (string.IsNullOrEmpty(e.Report.RemoteAddress))
return;

//if (e.Report.RemoteAddress == "::1")
// return;
//if (e.Report.RemoteAddress == "127.0.0.1")
// return;
if (e.Report.RemoteAddress == "::1")
return;
if (e.Report.RemoteAddress == "127.0.0.1")
return;

var request = WebRequest.CreateHttp("http://freegeoip.net/json/" + e.Report.RemoteAddress);
try
Expand Down
Expand Up @@ -68,7 +68,7 @@ public ActionResult Basics()
}
else
{
model.BaseUrl = Request.Url.ToString().Replace("installation/setup/basics/", "");
model.BaseUrl = Request.Url.ToString().Replace("installation/setup/basics/", "").Replace("localhost", "yourServerName");
ViewBag.NextLink = "";
}

Expand All @@ -83,6 +83,11 @@ public ActionResult Basics(BasicsViewModel model)
if (!model.BaseUrl.EndsWith("/"))
model.BaseUrl += "/";

if (model.BaseUrl.IndexOf("localhost", StringComparison.OrdinalIgnoreCase) != -1)
{
ModelState.AddModelError("BaseUrl", "Use the servers real DNS name instead of 'localhost'. If you don't the Ajax request wont work as CORS would be enforced by IIS.");
return View(model);
}
settings.BaseUrl = new Uri(model.BaseUrl);
settings.SupportEmail = model.SupportEmail;
ConfigurationStore.Instance.Store(settings);
Expand Down
2 changes: 1 addition & 1 deletion src/Server/OneTrueError.Web/Web.config
Expand Up @@ -2,7 +2,7 @@

<configuration>
<appSettings>
<add key="Configured" value="true" />
<add key="Configured" value="false" />
<add key="ScanForNewErrorReportsBatcher.Enabled" value="true" />
<add key="ScanForNewFeedback.Enabled" value="true" />

Expand Down

0 comments on commit c806f29

Please sign in to comment.