Since the last Octopus update (to 2023.1.9672) we receive an error on the Login screen when clicking “Sign In”.
Octopus is using IIS as a reverse proxy to make it available at http://octopus.xyz.local. The error occurs when using this URL. It does NOT occur when accessing it using the standard URL, e.g. http://localhost:8112.
“An invalid IP address was specified. An invalid argument was supplied.”
The log entry (full stack at the end of this post):
2023-03-07 10:51:35.1934 3612 276 INFO "HTTP" "POST" to "octopus.xyz.local""/api/users/login" "completed" with 500 in 00:00:00.0183649 (18ms) by "<anonymous>"
System.FormatException: An invalid IP address was specified.
---> System.Net.Sockets.SocketException (10022): An invalid argument was supplied.
--- End of inner exception stack trace ---
at System.Net.IPAddressParser.Parse(ReadOnlySpan`1 ipSpan, Boolean tryParse)
at System.Net.IPAddress.Parse(String ipString)
at Octopus.Server.Orchestration.Logging.IpNetworkChecker.IsIpAddressInRangeOfAnyIpNetworks(String ip, IEnumerable`1 ipNetworks) in ./source/Octopus.Server/Orchestration/Logging/IpNetworkChecker.cs:line 10
at Octopus.Server.Orchestration.Logging.OriginalClientIpAddressRetriever.Get(HttpContext httpContext) in ./source/Octopus.Server/Orchestration/Logging/OriginalClientIpAddressRetriever.cs:line 30
at Octopus.Server.Web.Controllers.Users.LoginUserController.LoginUser(LoginUserCommand command, CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Controllers/Users/LoginUserController.cs:line 31
IIS is set up with a Server Farm node with the following configuration in applicationHost.config:
<configuration>
<system.applicationHost>
<site name="Octopus" id="8" serverAutoStart="true">
<application path="/" applicationPool="Octopus">
<virtualDirectory path="/" physicalPath="C:\Octopus\iis-root" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80:octopus.xyz.local" />
</bindings>
</site>
<system.applicationHost>
</configuration>
C:\Octopus\iis-root\web.config contains this configuration:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://Octopus/{R:1}" />
</rule>
</rules>
</rewrite>
<security>
<requestFiltering>
<fileExtensions allowUnlisted="true">
<clear />
</fileExtensions>
<requestLimits maxUrl="16384" maxQueryString="16384" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
Neither an Octopus reinstall, nor update to the latest version helped. Any ideas?
Full stack trace:
2023-03-07 10:51:35.1934 3612 276 INFO "HTTP" "POST" to "octopus.xyz.local""/api/users/login" "completed" with 500 in 00:00:00.0183649 (18ms) by "<anonymous>"
System.FormatException: An invalid IP address was specified.
---> System.Net.Sockets.SocketException (10022): An invalid argument was supplied.
--- End of inner exception stack trace ---
at System.Net.IPAddressParser.Parse(ReadOnlySpan`1 ipSpan, Boolean tryParse)
at System.Net.IPAddress.Parse(String ipString)
at Octopus.Server.Orchestration.Logging.IpNetworkChecker.IsIpAddressInRangeOfAnyIpNetworks(String ip, IEnumerable`1 ipNetworks) in ./source/Octopus.Server/Orchestration/Logging/IpNetworkChecker.cs:line 10
at Octopus.Server.Orchestration.Logging.OriginalClientIpAddressRetriever.Get(HttpContext httpContext) in ./source/Octopus.Server/Orchestration/Logging/OriginalClientIpAddressRetriever.cs:line 30
at Octopus.Server.Web.Controllers.Users.LoginUserController.LoginUser(LoginUserCommand command, CancellationToken cancellationToken) in ./source/Octopus.Server/Web/Controllers/Users/LoginUserController.cs:line 31
at lambda_method6783(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Octopus.Server.Web.Middleware.BoundaryTrailerRewriteMiddleware.Invoke(HttpContext context, IAutomationContext automationContext) in ./source/Octopus.Server/Web/Middleware/BoundaryTrailerRewriteMiddleware.cs:line 44
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, IUnitOfWork unitOfWork) in ./source/Octopus.Server/Web/UnitOfWorkMiddleware.cs:line 46
at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, IUnitOfWork unitOfWork) in ./source/Octopus.Server/Web/UnitOfWorkMiddleware.cs:line 46
at Octopus.Server.Web.Middleware.OctopusClientOldVersionWarningMiddleware.InvokeAsync(HttpContext context, IAutomationContext automationContext) in ./source/Octopus.Server/Web/Middleware/OctopusClientOldVersionWarningMiddleware.cs:line 52
at Octopus.Server.Web.Middleware.DynamicContentHeadersMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/DynamicContentHeadersMiddleware.cs:line 48
at Octopus.Server.Web.Middleware.MaintenanceModeMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/MaintenanceModeMiddleware.cs:line 59
at Octopus.Server.Web.Middleware.OctopusAuthenticationMiddleware.InvokeAsync(HttpContext context, IUserAuthenticator userAuthenticator, IAuthCookieService authCookieService, IWebAuthCache authCache, ILogger logger) in ./source/Octopus.Server/Web/Middleware/OctopusAuthenticationMiddleware.cs:line 58
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Octopus.Server.Web.Middleware.LegacyRequestLoggerMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/LegacyRequestLoggerMiddleware.cs:line 41
at Octopus.Server.Web.Middleware.TelemetryMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/TelemetryMiddleware.cs:line 76
at Octopus.Server.Web.Middleware.ErrorHandlingMiddleware.InvokeAsync(HttpContext context) in ./source/Octopus.Server/Web/Middleware/ErrorHandlingMiddleware.cs:line 117