Is it possible to redirect from now www to www using mup js for EC2

Hi everyone,

I have deployed an app on AWS EC2 instance. Now I want it to get redirect to when user type in the url.

I am not able to figure out how to do it.

Here is something I found while searching regarding this

  1. Using Wizonesolutions Package found at StackOverflow
  2. Using this :

Please let me know if there is any other possible way to do the same. Any help would be greatly appreciated.

This part of our app is quite old so there are probably better ways to do it (at least by now) but the way i did it is right within the application’s server code:

WebApp.connectHandlers.use(function (req, res, next) {
    if (req.headers && !== Meteor.settings.mainUrl &&, 9) !== 'localhost') {
        res.writeHead(301, {
            Location: 'https://' + Meteor.settings.mainUrl + req.originalUrl
    } else {

where Meteor.settings.mainUrl is something like

this piece of code also allows you to point multiple Domains to your app and have them redirect to whatever main domain you want to use.

Thanks @chris74656, will try this and update you

Hi @chris74656, Could you share the changes that needs to be done in mup.js?