Thanks Björn!

I have tried ftp connection via server shell to external FTP server and it 
works. I was able to connect and upload files. Tried both active and passive 
modes.
...
227 Entering Passive Mode ( XXXX XXX XXXX)
150 Accepted data connection
226-File successfully transferred
...

So FirewallD ports are opened. Doing the same ftp_put via php in active or 
passive mode returns 504 Gateway timeout. 
That’s why I thought mby haproxy doesn't let FTP server response back in to 
server.

Mby you have any other suggestions in this case?


-----Original Message-----
From: Björn Zettergren [mailto:bjorn.zetterg...@deltaprojects.com] 
Sent: Monday, May 16, 2016 4:52 PM
To: Info (ITpartner.ee) <i...@itpartner.ee>
Cc: Andrew Smalley <asmal...@loadbalancer.org>; HAProxy <haproxy@formilux.org>
Subject: Re: HAproxy and ftp_put response "504 Timeout"

Hi Juri,

I suspect you have a problem with the FTP protocol and the clients active / 
passive mode. You need to forward the appropriate ports in your firewall/nat at 
the node running haproxy. Quick google suggested this read; 
http://slacksite.com/other/ftp.html


This is not a haproxy problem.

Best regards
Björn

On Mon, May 16, 2016 at 3:35 PM, Info (ITpartner.ee) <i...@itpartner.ee> wrote:
> Well yes, internal php script makes a call to some outside FTP server, 
> looking like:
>
>
>
> |--------------------------------------------------------------------------|
>
> | app_back (192.168.11.254) - > HAproxy (with public IP)|  - >   Some FTP
> hosting
>
> |--------------------------------------------------------------------------|
>
>
>
> Could you please clarify what do you mean under “loadbalance port 21”?
>
>
>
> From: Andrew Smalley [mailto:asmal...@loadbalancer.org]
> Sent: Monday, May 16, 2016 4:27 PM
> To: Info (ITpartner.ee) <i...@itpartner.ee>
> Cc: HAProxy <haproxy@formilux.org>
> Subject: Re: HAproxy and ftp_put response "504 Timeout"
>
>
>
> Juri
>
> Your welcome.
>
> I made an assumption that you would need to also loadbalance port 21 
> for ftp.
>
> Is your php script making a call to an external service or is it 
> behind haproxy?
>
>
> Regards
>
> Andrew Smalley
>
> Loadbalancer.org
>
> http://www.loadbalancer.org
>
>
>
> On 16 May 2016 at 14:24, Info (ITpartner.ee) <i...@itpartner.ee> wrote:
>
> Hello Andrew,
>
>
>
> Thanks for fast reply!
>
> I have already tried similar configuration and tried yours, but I get 
> “ERR_CONNECTION_REFUSED” on any http request to this server.
>
>
>
> After removing ftp_front and ftp_back + haproxy restart, all fine again.
>
>
>
> // Juri
>
>
>
> From: Andrew Smalley [mailto:asmal...@loadbalancer.org]
> Sent: Monday, May 16, 2016 4:10 PM
> To: Info (ITpartner.ee) <i...@itpartner.ee>
> Cc: HAProxy <haproxy@formilux.org>
> Subject: Re: HAproxy and ftp_put response "504 Timeout"
>
>
>
> Hello Juri
>
> You say your PHP Script uses FTP Protocol, so you will need to add 
> another VIP for ftp on port 21 in TCP Mode as shown below
>
> frontend app_front
>
>    bind *:80
>
>    default_backend admin_back
>
>
>
> backend admin_back
>
>    mode http
>
>    balance roundrobin
>
>    server admin 192.168.11.254:80 check
>
> frontend ftp_front
>
>
>
>    bind *:21
>
>    default_backend ftp_back
>
>
>
> backend ftp_back
>
>    mode tcp
>
>    balance roundrobin
>
>    server admin 192.168.11.254:21 check
>
>
> Regards
>
> Andrew Smalley
>
> Loadbalancer.org
>
> http://www.loadbalancer.org
>
>
>
> On 16 May 2016 at 14:02, Info (ITpartner.ee) <i...@itpartner.ee> wrote:
>
> Hello,
>
>
>
> Really need a help to solve this issue. We have PHP ftp file upload script.
> After project migration from regular hosting under HAproxy as a load 
> balancer, our php file upload script stopped working.
>
> We receive “504 Gateway Time-out. The server didn't respond in time.” 
> error after ~30 seconds. Increasing keep-alive time or php execution 
> time makes no effect.
>
> By checking php code line by line we realized that ftp_connect, 
> ftp_login – works fine,  but it gets an error after ftp_put request.
>
> Our haproxy conf looks like this:
>
>
>
> frontend app_front
>
>    bind *:80
>
>    default_backend admin_back
>
>
>
> backend admin_back
>
>    mode http
>
>    balance roundrobin
>
>    server admin 192.168.11.254:80 check
>
>
>
> Tried “ftp –n” connection directly from server – all fine. Turning off 
> FirewallD service on both haproxy and “admin_back” server makes no 
> difference.
>
> Can you give us any suggestions?
>
>
>
> BR,
>
> Juri
>
>
>
>



Reply via email to