Articles in this section

Can't set Docker Proxy Rules to an HTTPS container on Plesk: Error 502 Bad Gateway

kb: bug Plesk for Linux ext: docker

Applicable to:

  • Plesk for Linux

Symptoms

  • Configuring Docker Proxy Rules for a Docker container that binds HTTPS returns this error on the website:

    502 Bad Gateway
    Bad Request
    Your browser sent a request that this server could not understand.
    Reason: You're speaking plain HTTP to an SSL-enabled server port.
    Instead use the HTTPS scheme to access this URL, please.

  • After adding a Docker Proxy Rule in Domains > example.com > Docker Proxy Rules, Plesk adds proxy_pass configuration using HTTP:

    location ~ ^/.* {
    proxy_pass http://127.0.0.1:9444;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    }

Cause

This is Docker extension issue with ID EXTDOCKER-106, which will be fixed in future updates.

Resolution

While the fix is released, add the proxy rules manually, instead of using the Plesk panel feature:

  1. Log into Plesk

  2. Remove any rules from Domains > example.com > Docker Proxy Rules

  3. Go to Domains > example.com > Apache & nginx

  4. Add the following configuration to Additional nginx directives

    location ~ ^/.* {
    proxy_pass https://127.0.0.1:9444;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    }

  5. Press OK to save the changes

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.