Redirection to perl fcgi application


I have a server (let’s call it “serverA”) where haproxy is installed to load balance an application (Jira).
I have another server (“serverB”) where nginx is installed with spawn-fgi and runs Perl cgi applications.
I need these 2 applications to run under the same URL.

So I add the following to the frontend :

    acl is_myperlapp path_beg /myperlapp
    use_backend myperlapp if is_myperlapp

And the following to the backend :

backend myperlapp 
    mode http
    option httpchk
    option forwardfor
    http-request add-header X-Forwarded-Proto https if { ssl_fc }
    balance roundrobin
    server serverb maxconn 128

On serverB, nginx configuration is functional, so an URL like the following works well:


With this configuration, when I reach https://servera/myperlapp/test.cgi from a browser, it redirects to https://serverb/myperlapp/test.cgi
But I need to have this redirection transparent for user so it keeps https://servera/myperlapp/test.cgi in the browser URL.

How can we make that ?

Also, please note that I am new to haproxy, I don’t know if it’s possible to host perl fcgi scripts directly on the server running haproxy (serverA in my example above). I found some documentation online with php but not with perl. Is it possible and is there some documentation that I couldn’t find ?

Best Regards,