Saturday, September 23, 2017

Dealing with nginx “The plain HTTP request was sent to HTTPS port” error

by / Sunday, 21 September 2014 / Published in Linux, BSD, Unix

In some cases you have to run multiple services on a domain secured by SSL certificate, on various ports.

Users, who want to access your server at https://example.com:1337 often type just example.com:1337, which leads to plain HTTP request and the error specified above.

A single line in nginx configuration can prevent nginx from showing this error message, and redirect user user using the correct scheme instead. Just add

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

to your host configuration inside server { ... } block and reload the configuration:

[[email protected] #]service nginx reload
Read 980 times Last modified on Sunday, 08 March 2015 21:31

Do you like this? Please share!

Simon Tushev

Simon is IT professional with interests in web design, electronics, photography and astronomy. He writes about PHP, Yii, Joomla!, Arduino and several other topics.

Welcome!

Here I publish articles related to my areas of interest, my brief notes that may save some time to others, as well as some of my works.

This site is a work in progress. I will add more sections in the future, such as

  • More photos to photogallery
  • More Joomla!-related articles
  • ...

 

themeforest

New Posts

Using dynamic GeoIP module with nginx (CentOS)

nginx introduced dynamic module support in v. 1.9.11. This brief article provides step-by-step procedure...

13-04-2016 in Linux, BSD, Unix

READ MORE

Visual difference between pseudo and true random data

This is is "random" image generated using PHP rand() function: And this is an image...

20-11-2015 in Blog

READ MORE

Best EEPROM practices

(this article is a work in progress). My own advice will be added later...   Having...

12-10-2015 in Arduino

READ MORE
Scroll to top

We use cookies, just to track visits to our website, we store no personal details Privacy policy