I had to relocate our local service to another ip address and added a HAproxy to handle the request. My problem is that my client tries to send requests using Transfer-encoding: chunked. If I use this settings then I get error 411. HAProxy works in SSL termination mode. If there is no proxy used at client side (between JAX-WS client and HAproxy) then the connection works fine but if there is a proxy between them then it fails with error 411. I have two different clients. One of them uses McAfee Web Gateway the other one uses Squid 2.7. Both proxies require authentication. I tried different versions of HAProxy, Tomcat, JRE without success.
The scenario looks like this.
**Old config:** JAX-WS client request | ( Proxy ) | router with public ip (port 8442 for http and 8443 for https) | NATed JAX-WS endpoint running in Tomcat container 192.168.1.242:8080 **New config:** JAX-WS client request | (Proxy with or without authentication) | Router with public ip | | |----------- IPSec tunnel-----------------------------------------------------| | 192.168.91.246 192.168.1.242:8080 | | HAProxy (NATed) --------------- JAX-WS endpoint running in tomcat container | |-----------------------------------------------------------------------------| **A failed POST request:** POST /ddc/ddcService HTTP/1.1 Accept: text/xml, multipart/related Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxx= Content-Type: multipart/related;start="<rootpart*b440d52f-dee1-4735-9ff5-6093fa9d774b@example.jaxws.sun.com>";type="application/xop+xml";boundary="uuid:b440d52f-dee1-4735-9ff5-6093fa9d774b";start-info="text/xml" SOAPAction: "" User-Agent: JAX-WS RI 2.2.6-1b01 svn-revision#13094 Host: ddc.zzzz.com Proxy-Connection: keep-alive Transfer-Encoding: chunked **HAproxy config:** global log /dev/log local0 log /dev/log local1 notice info debug chroot /var/lib/haproxy stats socket /run/haproxy/admin.sock mode 660 level admin stats timeout 30s stats bind-process 7 user haproxy group haproxy daemon nbproc 7 tune.bufsize 32768 tune.ssl.default-dh-param 2048 ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL ssl-default-bind-options no-sslv3 defaults log global mode http bind-process 3 option httplog option dontlognull timeout connect 5000 timeout client 50000 timeout server 50000 option httpclose errorfile 400 /etc/haproxy/errors/400.http errorfile 403 /etc/haproxy/errors/403.http errorfile 408 /etc/haproxy/errors/408.http errorfile 500 /etc/haproxy/errors/500.http errorfile 502 /etc/haproxy/errors/502.http errorfile 503 /etc/haproxy/errors/503.http errorfile 504 /etc/haproxy/errors/504.http option forwardfor except 127.0.0.1 option tcp-smart-connect frontend incoming bind *:8080 name http bind *:4443 ssl crt /etc/letsencrypt/live/ddc.xxx.com/fullchain.pem.bundle option forwardfor header X-Real-IP use_backend ddc if ddc backend ddc option forwardfor mode http http-request set-header X-Forwarded-Port %[dst_port] http-request replace-header Host ^(.*?)(:[0-9]+)?$ \1 server ddc 192.168.1.242:8080 check port 8080