When you type in "dev1.example.com." into your browser or you request that Host with your HTTP client, I want it to redirect to "dev1.example.com". I've attempted to do this with the following server block:

server {
    listen 80;
    server_name dev1.example.com.;
    add_header Pragma no-cache;
    add_header Expires "Sat, 01 Jan 2000 00:00:00 GMT";
    add_header Cache-Control "private, no-cache, no-store, max-age=0, must-revalidate, post-check=0, pre-check=0";

    return 301 http://dev1.example.com$request_uri;

However, nothing seems to happen. I've attempted to clear my DNS resolver cache, clearing my own browser's DNS cache, and I've even requested the url with Curl. The URL I've requested is "dev1.example.com." I would expect it to redirect to "dev1.example.com".

  • What is the CURL output when you request dev1.example.com.? Jul 24, 2014 at 23:40
  • @TeroKilkanen It is the same for dev1.example.com
    – Ryan
    Jul 25, 2014 at 1:06

1 Answer 1


This configuration is working. You can check with CURL:

curl -v -H 'Host: dev1.example.com.' -o /dev/null http://dev1.example.com

Here is the transaction with CURL:

> GET / HTTP/1.1
> User-Agent: curl
> Accept: */*
> Host: dev1.example.com.
< HTTP/1.1 301 Moved Permanently
< Server: nginx
< Date: Fri, 25 Jul 2014 04:30:37 GMT
< Content-Type: text/html
< Content-Length: 184
< Connection: keep-alive
< Location: http://dev1.example.com/
< Pragma: no-cache
< Expires: Sat, 01 Jan 2000 00:00:00 GMT
< Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate, post-check=0, pre-check=0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.