Http请求重定向到https

问题描述:

目标:我希望将对 http://mydomain 的所有请求重定向到

Goal: I want all requests made to http://mydomain to be redirected to https://mydomain.

今天,我有一个Apache Web服务器,该服务器处理对 http://mydomain 发出的所有传入请求,并将它们重定向到 http://localhost:8080 (JBoss应用程序服务器).我在Apache配置中为我的虚拟主机使用proxypass.

Today I have an Apache web server which handles all incoming requests made to http://mydomain and redirects them to http://localhost:8080 (JBoss application server). I'm using proxypass for my virtual host in the Apache configuration.

要实现我的目标我需要做什么?

What do I need to do to achieve my goal?

Apache Foundation

The Apache Foundation recommended approach is to have a dummy VirtualHost on port 80 with:

<VirtualHost *:80>
    ServerName www.example.com
    Redirect "/" "https://www.example.com/"
</VirtualHost>

您可以为SSL配置现有的VirtualHost.

You can configure your existing VirtualHost for SSL.