Old forum software and Discourse on the same domain: how to work on new Discourse site not interrupting your community

user-agent
nginx

(Dmitry Fedyuk) #1

The process of moving from your old forum software to Discourse can be lengthy.
During the moving, you do not want to disrupt your existing community by half-done beta site.
The possible solution is to set up your browser and web server so the server will show you on demand your new Discourse forum while your community will see your current forum on the same domain.

What you see (new Discourse forum):

What your community sees (old forum):

Step 1.

Set up your web server (Nginx):

upstream discourse {server 127.0.0.1:4578;}
server {
    listen 80;
    server_name example.com;
    error_page 418 = @discourse;
    recursive_error_pages on;
    if ($http_user_agent = dmitry-fedyuk) {
        return 418;
    }
    location @discourse {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://discourse;
    }   
    <old site configuration...>
}

Nginx check for User-agent string and if it matches “dmitry-fedyuk” it shows the Discourse site. Otherwise, it shows old site.

Step 2.

So, when we what to see your new “beta” Discourse forum we need to pass “dmitry-fedyuk” as User-Agent.
How can we achieve what in comfortable way?
Google Chrome allows to set User Agent using DevTools:

Firefox has an extension User Agent Switcher: