I have an apache2 web server working great, today I added a subdomain redirect for my other services (jellyfin as an example)
The jellyfin redirection functions very well, jellyfin works on port 8096 on another IP address and when I type jelly.mydomain.fr it redirects well
Next, I have a proxmox instance I want to be redirected to, to access it in local I have to type https://IpAddress:8006 (nothing new here). Now I have set the proxmox.mydomain.conf files for both port 80 and 443 to redirect to https://IpAddress:8006 Now when I type it works well but when I do proxmox.mydomain.fr it redirects me to the local IP address which obviously does not work when not on the same network
proxmox.mydomain.fr.conf :
#<VirtualHost *:80>
# ServerName proxmox.mydomain.fr
#
# Rediriger toutes les requêtes HTTP vers l'URL HTTPS externe
# RewriteEngine On
# RewriteRule ^(.*)$ https://IpAddress:8006$1 [L,R=301]
# ErrorLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-error.log
# CustomLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-access.log combined
#</VirtualHost>
<VirtualHost *:80>
ServerName proxmox.mydomain.fr
ServerAlias www.proxmox.mydomain.fr
# Rediriger toutes les requêtes HTTP vers HTTPS sur le même domaine
Redirect permanent / /
ErrorLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-error.log
CustomLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-access.log combined
</VirtualHost>
I have tried with the commented text to redirect with the rewriteEngine directive but did not work with both the domain name and IP address
proxmox.mydomain.fr-ssl.conf :
<VirtualHost *:443>
ServerName proxmox.mydomain.fr
ServerAlias www.proxmox.mydomain.fr
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/proxmox.mydomain.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/proxmox.mydomain.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyPreserveHost On
ProxyPass / https://IpAddress:8006/
ProxyPassReverse / https://IpAddress:8006/
ErrorLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-error.log
CustomLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-access.log combined
</VirtualHost>
I tried with both rewriteEngine and Redirect directive, with the domain name or ip address but none seemed to work
The goal of the maneuver is to access the https resource by only typing proxmox.mydomain.fr, it works for some of my other services (in http) for proxmox only when typing https it works, I was hoping I could redirect the http request to the domain name and not the IP address
I haven't found any topic relating to this issue, maybe I don't know how to search
I have an apache2 web server working great, today I added a subdomain redirect for my other services (jellyfin as an example)
The jellyfin redirection functions very well, jellyfin works on port 8096 on another IP address and when I type jelly.mydomain.fr it redirects well
Next, I have a proxmox instance I want to be redirected to, to access it in local I have to type https://IpAddress:8006 (nothing new here). Now I have set the proxmox.mydomain.conf files for both port 80 and 443 to redirect to https://IpAddress:8006 Now when I type https://proxmox.mydomain.fr it works well but when I do proxmox.mydomain.fr it redirects me to the local IP address which obviously does not work when not on the same network
proxmox.mydomain.fr.conf :
#<VirtualHost *:80>
# ServerName proxmox.mydomain.fr
#
# Rediriger toutes les requêtes HTTP vers l'URL HTTPS externe
# RewriteEngine On
# RewriteRule ^(.*)$ https://IpAddress:8006$1 [L,R=301]
# ErrorLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-error.log
# CustomLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-access.log combined
#</VirtualHost>
<VirtualHost *:80>
ServerName proxmox.mydomain.fr
ServerAlias www.proxmox.mydomain.fr
# Rediriger toutes les requêtes HTTP vers HTTPS sur le même domaine
Redirect permanent / https://proxmox.mydomain.fr/
ErrorLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-error.log
CustomLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-access.log combined
</VirtualHost>
I have tried with the commented text to redirect with the rewriteEngine directive but did not work with both the domain name and IP address
proxmox.mydomain.fr-ssl.conf :
<VirtualHost *:443>
ServerName proxmox.mydomain.fr
ServerAlias www.proxmox.mydomain.fr
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/proxmox.mydomain.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/proxmox.mydomain.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyPreserveHost On
ProxyPass / https://IpAddress:8006/
ProxyPassReverse / https://IpAddress:8006/
ErrorLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-error.log
CustomLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-access.log combined
</VirtualHost>
I tried with both rewriteEngine and Redirect directive, with the domain name or ip address but none seemed to work
The goal of the maneuver is to access the https resource by only typing proxmox.mydomain.fr, it works for some of my other services (in http) for proxmox only when typing https it works, I was hoping I could redirect the http request to the domain name and not the IP address
I haven't found any topic relating to this issue, maybe I don't know how to search
With my naked eye I don't see any errors in your configuration, maybe you should make sure the apache config is reloaded (service apache2 reload
or similar command)
<VirtualHost *:80>
ServerName proxmox.mydomain.fr
ServerAlias www.proxmox.mydomain.fr
Redirect permanent / https://proxmox.mydomain.fr/
</VirtualHost>
<VirtualHost *:443>
ServerName proxmox.mydomain.fr
ServerAlias www.proxmox.mydomain.fr
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/proxmox.mydomain.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/proxmox.mydomain.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyPreserveHost On
ProxyPass / https://IpAddress:8006/
ProxyPassReverse / https://IpAddress:8006/
ErrorLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-error.log
CustomLog ${APACHE_LOG_DIR}/proxmox.mydomain.fr-access.log combined
</VirtualHost>