Next release: Using the power shell script below works to transfer the .war file from server A to server B through the tomcat manager ONLY when the size of the military file is slightly lower than 4 MB. Anything above this size fails with
Invoke-WebRequest: The underlying connection was closed: An unexpected error occurred while sending. In C: \ Temp \ deploy.ps1: 25 char: 2 + (Invoke-WebRequest -InFile "C: \ Temp \ fancy.war" -URI "https: ... + ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo: InvalidOperation: (System.Net.HttpWebRequest: HttpWebRequest) [Invoke-WebRequest], WebException + FullyQualifiedErrorId: WebCmdletWebResponseException, Microsoft.Power. Commands.InvokeWebRequestCommand
The code that I run through PowerShell on server A:
Set-PSDebug -Trace 1
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object
TrustAllCertsPolicy
$user = "admin"
$pass = "loveit"
$secpass = ConvertTo-SecureString $pass -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($user, $secpass)
(Invoke-WebRequest -InFile "C:\Temp\fancy.war" -URI "**https**://host99.some.domain:443/manager/text/deploy?path=/fancy&update=true" -Method PUT -Credential $credential -ContentType 'application/zip' -UseBasicParsing -TimeoutSec 120)
I also played with tomcat8 server.xml and tomcat manager web.xml as mentioned in the message How to deploy a war file in Tomcat 7
As you can see, with 50 MB I am safe.
\ WebApps \ manager \ WEB-INF \ web.xml
<multipart-config>
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
server.xml
<Connector port="443" maxPostSize="67589953" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2" useServerCipherSuitesOrder="true" ciphers="TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" server="Web Server" minSpareThreads="25" allowTrace="true" keystoreFile="cert.pfx" keystorePass="" keystoreType="PKCS12" connectionTimeout="100000000" />
Thank you for your help!