Can we do URL rewrites?


#1

Apologies for my incomplete understanding—but is there a way to do URL rewrites like in Apache or nginx? I need requests for “www.grooply.io” to be turned into “grooply.io” so it doesn’t break the same-origin policy for logins.

Thanks all :)))


#2

I think this is something you would do in Nginx, or in your DNS config - it sounds like a problem for the hosting layer rather than the web framework.


#3

Yes, it’s an nginx (or Apache) thing. You can’t actually do this with DNS (apparently).

My understanding is that a Meteor’s app’s HTTP server is the webapp package (as opposed to nginx or similar). So I’m not sure quite what to do.

But my problem is not unusual: I can’t serve my app from www.grooply.io, only grooply.io, because the OAuth providers are expecting only grooply.io. At the same time, I don’t want people who type in “www” to just be totally rejected, I want them to be redirected to grooply.io. What should I do?


#4

it depends where you host. But most universal answer would be nginx :smiley:


#5

Put nginx (with rewrite rule) in front of your Meteor app.


#6

Any links on how exactly to do that? :wink: Particularly since I’m on Modulus…


#7

I managed to use a 301 redirect served by my name provider to do what I wanted, but I’m still curious how you would use nginx with Meteor? Thanks all :slight_smile:


#8

You would need to run your own box or spin up a VPS. Google “nginx reverse proxy meteor” - there are a lot of tutorials/guides on this :slight_smile:


#9

Yep, found a few; it’s a good thing I’ve got the redirect working because I wouldn’t be able to set up an nginx proxy on Modulus. Thanks again y’all.