<meta property="og:description" content="Introduction 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://: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"> <meta name="twitter:description" content="Introduction 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://: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"> About Plesk URL or Telling Customers the Right Address to Go to - Plesk

Plesk & SocialBee have teamed up. Save 30% now!

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

Introduction

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.inc 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.

Links

7 Comments

  1. I have found an error in the article.

    Instead of
    /etc/sw-cp-server/conf.d/zzz-myhost.conf
    a
    /etc/sw-cp-server/conf.d/zzz-myhost.inc
    has to be created.

    The extension does the right thing

  2. Is there also a way to do this in a Plesk 12 Windows version?

    Many thanks,
    Bart

  3. Link to “Extension – custom-plesk-host” – broken.
    I tried to do this follow instructions on Plesk 12.0.18 #27, but no success.

  4. the customer is automagically redirected from http://example.com:8443 to https://panel.provider.com:8443

    Yes, this is working, but if the customer is already on a secure connection and uses https://example.com:8443, then it does not redirect and the terrible error informing them about an SSL certificate issued to a domain other than theirs shows up instead.

    since the customer already is on a secure connection with example.com there is no http_error 497… which would redirect the customer to panel.provider.com:8443

    I tried this in plesk -> domain example.com -> apache&nginx-setting:

    RewriteEngine On
    RewriteCond %{SERVER_PORT} ^8443
    RewriteCond %{HTTP_HOST} ^example.com?(.*)$ [NC]
    RewriteRule ^(.*)$ https://panel.provider.com:8443/$1 [R=301,L]

    But it has no effect. If I put other more simple rewriterules there they work.
    This is driving me crazy…

    Is using RewriteRules even the right solution to this problem?

    Plesk v12.5.30_build1205150826.19 os_Ubuntu 14.04
    Ubuntu 14.04.1 LTS

    Any help is highly appreciated!

  5. This blog is outdated. The current version of sw-cp-server parses the error_page directive the other way around, it cannot be overridden anymore.

    Instead of naming the file /etc/sw-cp-server/conf.d/zzz-myhost.inc you should name it /etc/sw-cp-server/conf.d/aaa-myhost.inc

Add a Comment

Your email address will not be published. Required fields are marked *

GET LATEST NEWS AND TIPS

  • Yes, please, I agree to receiving my personal Plesk Newsletter! WebPros International GmbH and other WebPros group companies may store and process the data I provide for the purpose of delivering the newsletter according to the WebPros Privacy Policy. In order to tailor its offerings to me, Plesk may further use additional information like usage and behavior data (Profiling). I can unsubscribe from the newsletter at any time by sending an email to [email protected] or use the unsubscribe link in any of the newsletters.

  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden

Related Posts

Knowledge Base