Redirecting with nginx

Today one of our server got in trouble with an ACE encoded IDN domain. The problem seemed to be rails in combination with nginx’s X-Sendfile feature. The result became that when accessing the site trough the IDN domain x-senfile did not send any files….

Our quick and dirty solution (until we have found the source/or solved the problem) became redirecting all traffic from the IDN domain to the domain without strange-swedish-characters.

With nginx this is as simple as in most webservers just put the following code before you original server configuration in nginx.conf.

1
2
3
4
server {
    server_name  xn--svenskdomn-y5a.se www.xn--svenskdomn-y5a.se;
    rewrite ^(.*) http://www.svenskdoman.se$1 permanent;
}

And Bowang! All requests to www.svenskdomän.se will be redirected to www.svenskdoman.se.

Domain names have been changed to protect the innocent :-)

Cheers!

Posted in Hosting, Rails at May 21st, 2008. Trackback URI: trackback Tags: , , Written by: 

It's past my bedtime is using WP-Gravatar