My application is deployed under haproxy server with domain name say fireapp.com, server1 and server2 are two servers below. Haproxy is configured to handle all requests under /live/ url format from server2.
Server2 contains live apps in format /live/app1, /live/app2
. So
http://fireapp.com/live/app1 and fireapp.com/live/app2 are served from server2.
Server1 is the web application in which home page loads an iframe. Iframe is using urls like
<iframe id="iframe" src="http://fireapp.com/live/app1" width="850px" height="900px" ></iframe>
When the page loads it throws error message, firebug says 404:network error for http://fireapp.com/live/app1
. While the app is available on
http://fireapp.com/live/app1 or http://server-2/live/app1.
Using
<iframe id="iframe" src="http://server-2/live/app1" width="850px" height="900px" ></iframe>
works but it comes under cross domain issue which i'm trying to avoid. I also tried providing only relative path but it fails on first load again.
<iframe id="iframe" src="/live/app1" width="850px" height="900px" ></iframe>
Just after page load if i try to update the src of iframe using the same previous url from console, it loads up the page.
Update:
Haproxy file.
global
log 127.0.0.1 local0 notice
maxconn 2000
user haproxy
group haproxy
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
timeout connect 50000
timeout client 100000
timeout server 100000
frontend http
bind :80
acl example path_reg -i ^/ey-\b
#acl url_static path_end -i .jpg .gif .png .css .js
acl url_stats path_beg /haproxy-stats
use_backend be_stats if url_stats
use_backend static if example
default_backend app
backend be_stats
stats uri /haproxy-stats
backend static
balance roundrobin
server host1 10.0.0.234:80 check
#server static 10.211.***.***:80 check
backend app
balance roundrobin
server host1 10.0.0.***:80 check
Best Answer
Try setting
option httpclose
or betteroption http-server-close
.In your configuration, haproxy will allow the browser to request the iframe content through the same keepalive connection as the original request, and the ACL that is supposed to make sure that the correct server is used will not have a chance to take effect.
Whenever you use ACLs and/or request manipulation options, you need to make sure that the appservers are not allowed to keep client connections open.