0

(Sorry for my bad english) Hi, i know that this is not the first question about redirect to a secure conection in a proxy server but i have no ideas how to resolv it.

this is my config

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

SSLEngine on
SSLProxyEngine on
SSLProxyCheckPeerCN Off
SSLCertificateFile /etc/ssl/certs/certificado.pem
SSLProtocol -all +TLSv1.2

<VirtualHost *:80 *:443>
Redirect permanent / https://dev.domain.com/

ServerName domain.com
serveralias dev.domain.com

ProxyPass /workflow http://172.16.1.105/workflow
ProxyPassReverse /workflow http://172.16.1.105/workflow

ProxyPass /redmine http://172.16.1.109/redmine
ProxyPassReverse /redmine http://172.16.1.109/redmine

ProxyPass /SucursalVirtual http://172.16.1.105/SucursalVirtual
ProxyPassReverse /SucursalVirtual http://172.16.1.105/sucursalvirtual

ProxyPass /WebCliente http://172.16.1.105/WebCliente
ProxyPassReverse /WebCliente http://172.16.1.105/WebCliente

</virtualhost>



<virtualhost *:443 *:80>

Redirect permanent / https://devbi.domain.com/
ServerName domain.com
serveralias devbi.domain.com

ProxyPass /app/ wss://172.16.0.252:443/app/ retry=0
ProxyPassReverse /app/ wss://172.16.0.252:443/app/ retry=0

ProxyPass /hub/qrsData wss://172.16.0.252:443/hub/qrsData retry=1 acquire=300 timeout=600 Keepalive=On
ProxyPassReverse /hub/qrsData wss://172.16.0.252:443/hub/qrsData

ProxyPass /windows_authentication/ https://172.16.0.252:4244/windows_authentication/ retry=1 acquire=300 timeout=600 Keepalive=On
ProxyPassReverse /windows_authentication/ https://172.16.0.252:4244/windows_authentication/

ProxyPass / https://172.16.0.252/ retry=1 acquire=300 timeout=600 Keepalive=On
ProxyPassReverse / https://172.16.0.252/

</virtualhost>

<Directory /var/www>
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<Directory /usr/local/apache2/htdocs>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

But if a redirect for example from http://google.com to https://google.com or another web page it works!! and if a redirect my owns *.domain.com to https doesnt work

i don have a .htaccess file and my apache2.conf is clean (no edit)

ERROR 400 Redictering to my owns domains to HTTPS

2 Answers2

0

For example you can try to edit your virtual host with something as follow:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName example.com
    SSLProxyEngine On
    RequestHeader set Front-End-Https "On"
    CacheDisable *
    ProxyPass /myapp https://ip:port/myapp
    ProxyPassReverse /myapp https://ip:port/myapp
    RedirectMatch ^/$ http://example.com/myapp
</VirtualHost>
r3d
  • 138
  • 8
0

I usually do something like this:

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias www.example.com
    ServerAdmin hostmaster@example.com

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    RedirectPermanent / https://www.example.com
</VirtualHost>

<VirtualHost *:443>
    ServerName www.example.com
    ServerAlias www.example.com
    ServerAdmin hostmaster@example.com

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    DocumentRoot /var/www/example

    <Directory /var/www/example>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    SSLEngine on
    SSLCertificateFile /certs/fullchain
    SSLCertificateKeyFile /certs/privkey
</VirtualHost>

Of course, ensure you have enabled both mod_ssl and your virtual host (a2enmod ssl and a2ensite <virtualhost.conf>, respectively).

Jose
  • 29
  • 3