Solved

apache redirect and/or forwarding

Posted on 2014-03-20
4
192 Views
Last Modified: 2014-08-15
what is the best way to forward all requests from port 80 to port 443 on an apache server (with tomcat behind it)?

my site basically gets accessed like this https://site.com/site
but i need to give users the ability to just type site.com or www.site.com and have it redirect to https://site.com/site

thanks
0
Comment
Question by:eli2011
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39943822
Here's what I was using.  Note that it forces Everything to HTTPS.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ https://www.site.com%{REQUEST_URI} [R=301]

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://www.site.com%{REQUEST_URI} [L,R=301]

Open in new window

1
 
LVL 13

Expert Comment

by:Daniel Helgenberger
ID: 39944178
Another way would be the firewall, forward port 80 to 443. The advantage(?): does not enforce https and can be used from any to any port:
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 443

Open in new window

0
 
LVL 2

Accepted Solution

by:
Puspharaj Selvaraj earned 500 total points
ID: 39944500
You can use Mod_jk for the redirection from apache to tomcat and vise-versa,

Mod_JK will cover the tomcat for security reason too.

If you need any confif help, just please come back here.
0
 
LVL 62

Expert Comment

by:gheist
ID: 39945040
<VirtualHost *:80>
  ServerAlias qwer.ty
  Redirect permanent / https://qwer.ty/ (probably temporary ipo permanent for testing)
</VirtualHost>
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Relic recently released its Synthetics product that allows for the creation of performance monitors that periodically test a site's performance. If you wish to test an interactive workflow New Relic employs Selenium WebDriverJS to run those test…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question