LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   HAProxy Redirect (https://www.linuxquestions.org/questions/linux-software-2/haproxy-redirect-4175585789/)

prash.devops 07-29-2016 08:05 AM

HAProxy Redirect
 
Here is my setup.

frontend http-in-ssl bind *:80 bind *:443 ssl crt /etc/haproxy/ssl log 127.0.0.1 local1 notice option httplog reqadd X-Forwarded-Proto:\ https reqadd X-Forwarded-Proto:\ http

acl alpha hdr(host) -i alpha.example.com
acl beta hdr(host) -i beta.example.com
redirect scheme https if !{ ssl_fc } alpha
redirect scheme https if !{ ssl_fc } beta
use_backend alpha-backend if { ssl_fc_sni alpha.example.com }
use_backend beta-backend if { ssl_fc_sni beta.example.com }
backend alpha-backend
server alpha-server-server 192.168.1.100:8080 check inter 2000 maxconn 500 rise 2 fall 3
backend beta-backend
server beta-server-server 192.168.1.200:8090 check inter 2000 maxconn 500 rise 2 fall 3
Here i would like to achieve is if any one tried tried to hit alpha.example.com/rest/api it should redirecto to 192.168.1.150:8085 and convert all request to https

TB0ne 07-29-2016 11:11 AM

Quote:

Originally Posted by prash.devops (Post 5582887)
Here is my setup.

frontend http-in-ssl bind *:80 bind *:443 ssl crt /etc/haproxy/ssl log 127.0.0.1 local1 notice option httplog reqadd X-Forwarded-Proto:\ https reqadd X-Forwarded-Proto:\ http

acl alpha hdr(host) -i alpha.example.com
acl beta hdr(host) -i beta.example.com
redirect scheme https if !{ ssl_fc } alpha
redirect scheme https if !{ ssl_fc } beta
use_backend alpha-backend if { ssl_fc_sni alpha.example.com }
use_backend beta-backend if { ssl_fc_sni beta.example.com }
backend alpha-backend
server alpha-server-server 192.168.1.100:8080 check inter 2000 maxconn 500 rise 2 fall 3
backend beta-backend
server beta-server-server 192.168.1.200:8090 check inter 2000 maxconn 500 rise 2 fall 3
Here i would like to achieve is if any one tried tried to hit alpha.example.com/rest/api it should redirecto to 192.168.1.150:8085 and convert all request to https

Great....so if you actually provide us with any usable DETAILS, we can try to help. You tell us nothing about what you're using (squid? nginx? apache?), version/distro of Linux, your network environment, etc. We can't (and WON'T) guess. Read the "Question Guidelines" link in my posting signature.

prash.devops 07-29-2016 11:20 AM

Its my bad. I am using haproxy as the reverse proxy . I have given above configuration for haproxy

TB0ne 07-29-2016 12:01 PM

Quote:

Originally Posted by prash.devops (Post 5582972)
Its my bad. I am using haproxy as the reverse proxy . I have given above configuration for haproxy

And ***STILL*** don't give us ANY of the details you were asked for previously. Either answer the questions asked, and provide details, or there isn't much point in posting.


All times are GMT -5. The time now is 11:15 PM.