Good Morning,
I need to perform via HAProxy, a redirect where everything that comes through the URL int-tasy-hs-dev.oncoclinicas.com.br, is redirected to int-tasy-hs-dev.oncoclinicas.com.br/WhebServidorIntegracao. I use HAProxy + Weblogic. In this case, there is a particularity in my Weblogic an Application, responds in Context /. And in a note from the HA documentation there is the following statement:
“if is /, then the redirection is performed to the same URL. This can be used to insert a cookie.”
That is, HA if the prefix is the / context, it redirects to /. The configuration I have is as follows:
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 10000
user haproxy
group haproxy
daemon
# turn on stats unix socket
stats socket /var/lib/haproxy/stats
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 30s
timeout queue 30s
timeout connect 30s
timeout client 5m
timeout server 240m
timeout http-keep-alive 30s
timeout check 30s
maxconn 10000
compression algo gzip
compression type text/html text/plain text/css text/javascript text/css
frontend Tasy_DEV
bind *:80
bind *:443 ssl crt /etc/haproxy/ssl/oncoclinicas.com.br.pem
redirect scheme https if !{ ssl_fc }
default_backend philips_tasy
backend philips_tasy
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
balance roundrobin
option httpclose
option forwardfor
cookie SERVERID insert indirect nocache
server ms_1 10.27.10.26:7011 check cookie ms_1
frontend Lab_DEV
bind *:8080
bind *:7443 ssl crt /etc/haproxy/ssl/oncoclinicas.com.br.pem
redirect scheme https if !{ ssl_fc }
default_backend Lab_DEV
backend Lab_DEV
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
balance roundrobin
option httpclose
option forwardfor
cookie SERVERID insert indirect nocache
server ms_1 10.27.10.26:7011 check cookie ms_1
frontend WSI_DEV
bind *:8091
bind *:8443 ssl crt /etc/haproxy/ssl/oncoclinicas.com.br.pem
acl host_client hdr(host) -i int-tasy-hs-dev.oncoclinicas.com.br
http-request redirect code 301 location int-tasy-hs-dev.oncoclinicas.com.br/WhebServidorIntegracao if host_client
default_backend WSI_DEV
backend WSI_DEV
#redirect scheme https code 301 if !{ ssl_fc }
stats enable
stats uri /haproxy?stats
stats realm Strictly\ Private
balance roundrobin
option httpclose
option forwardfor
cookie SERVERID insert indirect nocache
server ms_1 10.27.10.26:7011 check cookie ms_1
The first alternative I had tested was:
redirect prefix http://int-tasy-hs-dev.oncoclinicas.com.br code 301 if { hdr(host) -i www.int-tasy-hs-dev.oncoclinicas.com.br/WhebServidorIntegracao }
redirect prefix http://www.int-tasy-hs-dev.oncoclinicas.com.br code 301 if { hdr(host) -i www.int-tasy-hs-dev.oncoclinicas.com.br/WhebServidorIntegracao }
Can you help me try to redirect?