LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-19-2018, 05:26 PM   #1
cabotek
LQ Newbie
 
Registered: Sep 2018
Posts: 4

Rep: Reputation: Disabled
SSL termination behind load balancer- Rack Space & WP Multisite


Hey Guys,

I have 2 web servers sitting behind a load balancer at Rack Space Cloud set up with SSL termination. I'm looking to force HTTP to HTTPS and I believe I would need to do it in the vhost.conf file of the vhost.d directory. These are CentOS machines. I added the below code but it appears to break it.

Code:
RewriteEngine On

RewriteCond %{HTTP:X-Forwarded-Proto} !https

RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
The site also has lots of alias names and redirects to country that corresponds to it's language, for example .com goes to .com.mx for latin users.

Any ideas?

Thanks!
 
Old 09-20-2018, 11:55 AM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,726

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
I use Redirect, not Rewrite, to force https
Code:
Redirect permanent / https://mydomain.com/
in the VirtualHost port 80 definition. Of course, there must also be a VirtualHost for port 443 for the Redirect to work.

That said, I'm not sure your Rewrite syntax is correct, but I don't know for sure.
Here's a link to the Apache documentation.
See the extensive discussion for RewriteRule...
 
1 members found this post helpful.
Old 09-22-2018, 09:27 PM   #3
cabotek
LQ Newbie
 
Registered: Sep 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
So I ended up putting a rewrite rule in the vhosts conf file which did the trick. After that I have been having to work on ref links of mixed content which is using http still. So ran a grep to sed command to find and replace all instances of references with http to // for their relative link. SO far it's good.
 
Old 09-24-2018, 12:16 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by cabotek View Post
So I ended up putting a rewrite rule in the vhosts conf file which did the trick. After that I have been having to work on ref links of mixed content which is using http still. So ran a grep to sed command to find and replace all instances of references with http to // for their relative link. SO far it's good.
http values may be in a db table, such as wp_posts.
there's a utility that does that for you and it is quite nice.
searchandreplace .
Note: It is not an "addon"
 
Old 11-01-2018, 09:09 PM   #5
cabotek
LQ Newbie
 
Registered: Sep 2018
Posts: 4

Original Poster
Rep: Reputation: Disabled
Appreciate the info on search and replace. May need it here very soon.

I need to create a staging environment for a clients web server. They have 2 web servers and 1 DB server behind a LB with SSL termination at the LB. The server already has a vhost folder for a staging server and dns pointing to the staging folder. It also has .htaccess and .htpasswd authentication. But when I go to the testserver webpage, most of the links in the server reference the original site. so even though on the homepage im at testexample.com it sends me to example.com. With google developer tools I can see the links on the page reference the original site.

I guess is search and replace the answer for fixing the test server? Or even better yet any info on how to best set up a staging environment, that I can hand over to the web developers and make it an easy push to live.

I'm not a professional at this so explaining things helps me quite a bit in my learning.

Thanks!
 
  


Reply



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
SSL integration with apache working as a load balancer with mod_proxy zama Linux - Server 1 12-03-2013 09:41 PM
[SOLVED] SSL Certificate for multiple hosts behind load balancer S-S Linux - Server 1 06-05-2013 10:20 AM
SSL termination dazdaz General 2 05-30-2012 05:22 PM
[SOLVED] High-Availability HTTP Load Balancer With HAProxy & Heartbeat on RHEL 5.4 vikas027 Linux - Server 2 10-17-2010 12:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:54 PM.

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