• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Docker // The plain HTTP request was sent to HTTPS port

sabietzki

New Pleskian
Server operating system version
Ubuntu 22
Plesk version and microupdate number
18.0.44
Hello,
i have a docker container and added a rule to one of my domains. on port 80 the docker containers works very well. But when i change the proxy rules to port 443 (docker internal) i getting 400 Bad Request The plain HTTP request was sent to HTTPS port - error. what can i do?
 
Hi,

Plesk will add a little piece of configuration to your nginx configuration for your domain when setting up Docker Proxy Rules. The docker extension is, quite frankly, very limited in this regard and will always proxy your request to http://0.0.0.0:<port>.

When you're accessing your domain via https://example.com it will internally access http://0.0.0.0:<port> (note the missing s). This is fine if your docker application serves data over http, but if it requires https you'll get your 400 Bad Request error.

One way to temporarily fix this is to edit your domain configuration, usually located at:
/var/www/vhosts/system/<domain>/conf/nginx.conf

Scroll down a bit and somewhere in there you'll see:
Code:
#extension docker begin
location ~ ^/.* {
        proxy_pass http://0.0.0.0:<port>;
        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;
}
#extension docker end

Change http:// to https:// and restart nginx. Depending on your distro this could be as easy as: service nginx reload.

PLEASE NOTE: these changes are NOT permanent. Modifying the domain hosting configuration using the Plesk interface could easily reset or override this. Keep this in mind.

For the Plesk team:

It would be great if you added a new option to allow proxying the request using the https;// handler. Something like this perhaps?
plesk.jpg

Cheers,
 
Back
Top