Redirect from HTTP to HTTPS does not work

Francis Daly francis at daoine.org
Tue Aug 11 07:35:55 UTC 2015


On Tue, Aug 11, 2015 at 02:53:21AM -0400, StSch wrote:

Hi there,

> This is my configuration:
> 
> server {
>   listen 80;
>   server_name shell.*;
>   return 301 https://$server_name$request_uri;
> }

When you request "http://shell.example.com/uri", this will redirect to
"https://shell.*/uri", which is probably not what you want.

Use (for example) $host instead of $server_name.

Or (possibly better) use shell.raspi.dyndns.com instead of $server_name.

> Any idea what the problem could be and how to fix it?

Use "curl -i" to make the http request. See the response.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list