About Plesk URL or Telling Customers the Right Address to Go to


A long time ago Plesk had one good little feature: when typing the panel address in your browser address bar, if you specified the port (8443), but omitted the encryption method (https), Plesk would redirect you to the address https://<server_hostname>:8443. In version 11.5, we replaced the lighttpd web server that served Plesk with nginx. And broke that good little feature.

Right away, our users pointed out that breaking good little features and giving nothing in return is bad. Please forgive and forget :) As you can see in Plesk 12.0 preview (available through autoinstaller with –all-versions key), we returned the previous behavior.

What’s our point in telling this story? We wanted to share one interesting use-case proposed by our users and to contribute to it.

So, let’s assume that your server hostname is panel.provider.com and you installed a valid SSL certificate to protect Plesk. Now you tell your customer: “To enter the hosting control panel, add :8443 to your domain name. For example, example.com:8443.” After that, the customer is automagically redirected from http://example.com:8443 to https://panel.provider.com:8443 and kept out of a terrible error informing them about an SSL certificate issued to a domain other than theirs, an attempt to steal their data and other horror stories that browsers tell. The customer sees the green address bar in their browser and does not see any errors – the provider’s credibility grows.

How it works and what else can be done with it

The magic is hidden in the /etc/sw-cp-server/config configuration file, namely in the following string:

error_page 497 https://$hostname:$server_port$request_uri;

In case a plain HTTP request was sent to an HTTPS port, this string makes the web server (works only for nginx) redirect the user to the “correct” address. The correct address consists of the correct https protocol, the server hostname, port number and the remaining part of the “incorrect” request.

As many of you have already guessed it right, we can replace the $hostname variable with a definite address. Thus, we get rid of strict binding to the server hostname. Still, editing the configuration file is a very bad idea. Most likely, further Plesk updates will not install correctly, because the configuration file was changed. That’s why we are going to create a new file, where we simply redefine this instruction. We will create a /etc/sw-cp-server/conf.d/zzz-myhost.conf file with the following content:

error_page 497 https://panel.provider.com:$server_port$request_uri;

Then restart sw-cp-server

/etc/init.d/sw-cp-server restart

Thus, all users will be directed to https://panel.provider.com:8443 regardless of the server hostname.

Cherry on Top

For those who do not like working with console or editing configuration files, we developed an extension that does this work for you. It will be especially useful for those who actively use Custom View and do not have an access to the server. The only limitation of this extension is that the settings are not applied automatically. You will have to restart the sw-cp-server service or the whole server.


The post About Plesk URL or Telling Customers the Right Address to Go to is fed from ReadySpace Cloud and Managed Hosting. Contents strictly belongs to ReadySpace and its respective partners.

There are no comments.

Leave a Reply