ฉันต้องการตั้งค่า Apache reverse proxy สำหรับอินสแตนซ์ Home-Assistant (hass) ที่ทำงานอยู่ในเครือข่ายท้องถิ่นของฉัน
ฉันทันเนลทราฟฟิกของอินสแตนซ์ hass ในเครื่องไปยังเซิร์ฟเวอร์ระยะไกลด้วย ssh -N proxy@example.com -R 8123:localhost:8123.
ตอนนี้ฉันพยายามตั้งค่า reverse proxy ธรรมดาใน Apache:
<VirtualHost *:443>
    ServerName hass.example.com
    SSLEngine On
    # If you manage SSL certificates by yourself, these paths will differ.
    SSLCertificateFile fullchain.pem
    SSLCertificateKeyFile privkey.pem
    SSLProxyEngine on
    SSLProxyProtocol +TLSv1.2 +TLSv1.3
    SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyVia On
    RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
    
            
    # Proxy all traffic to hass
    ProxyPass / http://localhost:8123/ nocanon
    ProxyPassReverse / http://localhost/
    ErrorLog ${APACHE_LOG_DIR}/hass.example.com-error.log
    CustomLog ${APACHE_LOG_DIR}/hass.example.com-access.log combined
    <IfModule security2_module>
        SecRuleEngine off
    </IfModule>
</VirtualHost>
<VirtualHost *:80>
    ServerName hass.example.com
    Redirect permanent / "https://hass.example.com"
    ErrorLog ${APACHE_LOG_DIR}/hass.example.com-error.log
    CustomLog ${APACHE_LOG_DIR}/hass.example.com-access.log combined
</VirtualHost>
น่าเศร้าถ้าฉันพยายามที่จะเปิด hass.example.comเบราว์เซอร์ตอบสนองด้วย 400: คำขอไม่ถูกต้อง.