ssl redirect issue

Adam Tistler atistler at gmail.com
Thu Sep 22 11:23:46 UTC 2011


Actually, I can work around this issue by adding:

        if ($host !~* ^(my.example.net)$ ) {
           rewrite ^(.*) https://my.example.net$1 permanent;
        }

I am curious however this does not work when I put the redirect in the default ( '_' ) server config

On Sep 22, 2011, at 5:17 AM, Adam Tistler wrote:

> Hi,
> 
> I have an ssl nginx setup which was working fine with one server { ssl on }.  However I have legacy ssl server_names that I would like to have a 'catch all' for that should be redirected back to the 'main' ssl server name.  Config is pasted here.
> 
> http://pastebin.com/dXU7BHaB      ( I removed some sections for brevity )
> 
> 
> When the following lines are enabled:
> 
>     server {
>         listen 443 default;
>         server_name _;
>         rewrite ^(.*) https://my.example.net$1 permanent;
>     }
> 
> I will get:
> 
> SSL received a record that exceeded the maximum permissible length.
> (Error code: ssl_error_rx_record_too_long)
> 
> If i comment those lines out, the request will go thru just fine.  However since:
> 
>     server {
>         listen 443;
>         server_name  my.example.net;
> 
> 
> is treated as the default vhost,  even ssl requests for myold.example.net are serviced by this server {} and are not redirected to https://my.example.net (obviously not what I want).
> 
> Thanks for the help in advanced.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20110922/95a79cdd/attachment.html>


More information about the nginx mailing list