diff --git a/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/HttpConnection.ts b/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/HttpConnection.ts index fcc76ce879..795ce730d7 100644 --- a/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/HttpConnection.ts +++ b/client-ts/Microsoft.AspNetCore.SignalR.Client.TS/HttpConnection.ts @@ -173,6 +173,10 @@ export class HttpConnection implements IConnection { ? `${window.document.location.protocol}//${(parser.host || window.document.location.host)}` : `${parser.protocol}//${parser.host}`; + if (!url || url[0] != '/') { + url = '/' + url; + } + let normalizedUrl = baseUrl + url; this.logger.log(LogLevel.Information, `Normalizing '${url}' to '${normalizedUrl}'`); return normalizedUrl; diff --git a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/Properties/launchSettings.json b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/Properties/launchSettings.json new file mode 100644 index 0000000000..83318595ad --- /dev/null +++ b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:60249/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Microsoft.AspNetCore.SignalR.Test.Server": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:5000/" + } + } +} \ No newline at end of file diff --git a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/connectionTests.js b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/connectionTests.js index 1f3ee9574b..80df786ab4 100644 --- a/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/connectionTests.js +++ b/client-ts/Microsoft.AspNetCore.SignalR.Test.Server/wwwroot/js/connectionTests.js @@ -34,7 +34,9 @@ describe('connection', function () { eachTransport(function (transportType) { it("over " + signalR.TransportType[transportType] + " can send and receive messages", function (done) { var message = "Hello World!"; - var connection = new signalR.HttpConnection(ECHOENDPOINT_URL, { + // the url should be resolved relative to the document.location.host + // and the leading '/' should be automatically added to the url + var connection = new signalR.HttpConnection("echo", { transport: transportType, logging: signalR.LogLevel.Trace });