I am developing an E-learning platform and have decided it will be best to split the site into three sections (each with its own meteor application). The three sections being:
According to iron-router Issue 223 there is no option for subdomain routing so I won't be able to have a common routes file serving all three subdomains.
Also I believe login sessions are stored in localStorage so users will not be able to stay logged in moving across subdomains.
What is the recommended way to create this sort of application or am I better keeping the entire application as I have it currently using /admin /learner. I am against this solution as it is causing the codebase to grow large (with lots of if hasRole 'admin'
type code) very quickly and in order to keep the application as secure as possible I like the idea of having completely subscriptions and publications.
Setup a nginx proxy in front of meteor, that routes the subdomains to the same location. So it is actually the same application but to the user it doesnt look like it.
The http section of that config will look something like this:
http {
server {
listen 80;
server_name nvqhq.com;
location / {
proxy_pass http://localhost:3000/marketing;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
server {
listen 80;
server_name admin.nvqhq.com;
location / {
proxy_pass http://localhost:3000/admin;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
server {
listen 80;
server_name learners.nvqhq.com;
location / {
proxy_pass http://localhost:3000/learners;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
}
In this setup by default the login probably only works on the /marketing level. So you might have to change the domain the session cookies are set for in meteor.
But first try to get this setup running.