LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-29-2016, 09:05 AM   #1
prash.devops
LQ Newbie
 
Registered: May 2016
Posts: 2

Rep: Reputation: Disabled
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
 
Old 07-29-2016, 12:11 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 24,469

Rep: Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243
Quote:
Originally Posted by prash.devops View Post
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.
 
1 members found this post helpful.
Old 07-29-2016, 12:20 PM   #3
prash.devops
LQ Newbie
 
Registered: May 2016
Posts: 2

Original Poster
Rep: Reputation: Disabled
Its my bad. I am using haproxy as the reverse proxy . I have given above configuration for haproxy
 
Old 07-29-2016, 01:01 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 24,469

Rep: Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243Reputation: 7243
Quote:
Originally Posted by prash.devops View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Nginx, Horde, Https, Redirect, This webpage has a redirect loop axetone Ubuntu 0 02-08-2015 11:44 PM
[SOLVED] haproxy with hostname snjksh Linux - Software 1 04-30-2013 11:08 AM
stunnel with haproxy 1.4.6 cbtshare Linux - Software 6 08-09-2010 02:35 PM
haproxy agarwalpranay Linux - Newbie 4 06-19-2010 02:31 AM
Haproxy by host guruyaya Linux - Server 0 08-26-2008 09:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration