Plex, Apache, ProxyPass - Reason: Error reading from remote server

Server Version#: 1.15.4.993-bb4a2cb6c
Player Version#: N/A
Server: Ubuntu 18.04.2 LTS
Apache: 2.4.29-1ubuntu4.6

For the past few weeks, I have noticed that whenever I try to connect to my plex server over Apache2 reverse proxying to Plex, it fails with:

Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /plex/web/index.html.

Reason: Error reading from remote server

Prior to this, the configuration was working for a few years.

My Apache2 Configuration was/is this:

    <Location /plex>
        Session On
        SessionMaxAge 1800
        SessionCookieName session path=/
        ErrorDocument 401 /login.html#

       RewriteCond %{X-Plex-Client-Identifier} ^(.*)$
        RewriteRule ^/$ /plex/$1

        ## Redirect Setup
        # Determine if requests is secure and set a SECURE variable
        RewriteCond %{HTTPS} =on
        RewriteRule ^/plex/?$ - [env=SECURE:s]
        #Redirect /plex/ to /plex/web/index.html
        RewriteRule ^/plex/?$ http%{ENV:SECURE}://%{HTTP_HOST}/plex/web/index.html [R=301,L]
        RewriteRule ^/plex/?$ http://%{HTTP_HOST}/plex/web/index.html [R=301,L]
        ## Proxy Setup
        # Proxy /plex/* URI to PLEX and set PROXYPLEX variable
        RewriteRule ^/plex/(.*) http://localhost:32400/$1 [P,ENV=PROXYPLEX:true,L]
        # Proxy requests with /plex/ Refererals or "X-Plex-Product: Plex" HTTP headers to PLEX
        RewriteCond %{HTTP_REFERER} ^https?://.*/plex [OR]
        RewriteCond %{HTTP_REFERER} ^http?://.*/plex [OR]
        RewriteCond %{HTTP:X-Plex-Product} ^Plex
        RewriteRule ^/(.*) http://localhost:32400/$1 [P,ENV=PROXYPLEX:true,L]
        # If I ever proxied the request, rewrite the Referer hostname to localhost
        # Otherwise plex sees: Request came in with unrecognized domain 'www.myinternaldomain.local' in header Referer; treating as non-local, and the some requests result in a 401
        RequestHeader edit Referer domain.org localhost env=PROXYPLEX

        ProxyPass http://192.168.2.8:32400
        ProxyPassReverse http://192.168.2.8:32400
        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"
        </Location>
        <Location /web>
        ProxyPass http://192.168.2.8:32400/web
        ProxyPassReverse http://192.168.2.8:32400/web
        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"
        </Location>

Initially, I thought this was due to a lack of SSL Cert (since I let mine expire). However, after renewing the certificate, I am still experiencing this error above. So I started searching, figuring I might as well take the time to switch to plex.domain.org instead of using domain.org/plex, I set this up:
https://gist.github.com/HazCod/3ef10a15f52c171a7839#gistcomment-2891893

Has something changed in the configuration? I don’t have anything abnormal configured on my plex server, I have not changed anything with apache2.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.