Skip to content

Commit c806f29

Browse files
author
gauffininteractive
committed
Made sure that localhost is not user as servername to prevent AJAX requests from failing.
1 parent 36a8e20 commit c806f29

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/Server/OneTrueError.App/Modules/Geolocation/EventHandlers/StorePositionFromNewReport.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ public async Task HandleAsync(ReportAddedToIncident e)
4242
if (string.IsNullOrEmpty(e.Report.RemoteAddress))
4343
return;
4444

45-
//if (e.Report.RemoteAddress == "::1")
46-
// return;
47-
//if (e.Report.RemoteAddress == "127.0.0.1")
48-
// return;
45+
if (e.Report.RemoteAddress == "::1")
46+
return;
47+
if (e.Report.RemoteAddress == "127.0.0.1")
48+
return;
4949

5050
var request = WebRequest.CreateHttp("http://freegeoip.net/json/" + e.Report.RemoteAddress);
5151
try

src/Server/OneTrueError.Web/Areas/Installation/Controllers/SetupController.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public ActionResult Basics()
6868
}
6969
else
7070
{
71-
model.BaseUrl = Request.Url.ToString().Replace("installation/setup/basics/", "");
71+
model.BaseUrl = Request.Url.ToString().Replace("installation/setup/basics/", "").Replace("localhost", "yourServerName");
7272
ViewBag.NextLink = "";
7373
}
7474

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

86+
if (model.BaseUrl.IndexOf("localhost", StringComparison.OrdinalIgnoreCase) != -1)
87+
{
88+
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.");
89+
return View(model);
90+
}
8691
settings.BaseUrl = new Uri(model.BaseUrl);
8792
settings.SupportEmail = model.SupportEmail;
8893
ConfigurationStore.Instance.Store(settings);

src/Server/OneTrueError.Web/Web.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<configuration>
44
<appSettings>
5-
<add key="Configured" value="true" />
5+
<add key="Configured" value="false" />
66
<add key="ScanForNewErrorReportsBatcher.Enabled" value="true" />
77
<add key="ScanForNewFeedback.Enabled" value="true" />
88

0 commit comments

Comments
 (0)