Bonjour à tous,
J'ai 2 sites web:
site n ° 1: https://private.mydomain.net/
site n ° 2: http://localhost:3000/ qui retourne
http://localhost:3000/lua/index.lua?bloc_instruction/
Le fait est que je veux faire un proxy du site n ° 1 vers le site n °2 sur un répertoire "site2" pour avoir:
https://private.mydomain.net/site2 -> https://private.mydomain.net/site2/lua/index.lua?bloc_instruction
Pour cela, j'ai créé un fichier de configuration site2.conf dans /etc/apache2/conf-available comme ceci:
ProxyRequests Off
ProxyHTMLExtended On
ProxyPass /site2/ http://127.0.0.1:3000/
<Location /site2/>
ProxyPassReverse /
SetOutputFilter proxy-html
ProxyHTMLURLMap / /site2/
RequestHeader unset Accept-Encoding
</Location>
et voici le résultat quand j'entre dans le lien:
https://private.mydomain.net/site2 devient
https://private.mydomain.net/lua/index.lua?bloc_instruction
au lieu de
https://private.mydomain.net/site2/lua/index.lua?bloc_instruction
Comment puis-je réparer cela ?
voici la config du site principal qui héberge un serveur nextcloud :
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName private.mydomain.net
Include /etc/letsencrypt/options-ssl-apache.conf
<Directory /var/www/html>
AllowOverride All
</Directory>
<IfModule proxy_fcgi_module>
# Enable http authorization headers
<IfModule setenvif_module>
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
</IfModule>
<FilesMatch ".+\.ph(ar|p|tml)$">
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
<FilesMatch ".+\.phps$">
# Deny access to raw php sources by default
# To re-enable it's recommended to enable access to the files
# only in specific virtual host or directory
Require all denied
</FilesMatch>
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(ar|p|ps|tml)$">
Require all denied
</FilesMatch>
</IfModule>