now-redirect icon indicating copy to clipboard operation
now-redirect copied to clipboard

Problem setting-up

Open pierregoutheraud opened this issue 7 years ago • 6 comments

Hello, there must something I do not understand because I can not get this to work. I would like to redirect all traffic from mydomain.com to www.mydomain.com.

So I go to my app folder and type now-redirect www.mydomain.com

It deploys MY app on https://mydomain-gfhsgtwezq.now.sh But it says: Requests to https://mydomain-gfhsgtwezq.now.sh/* will be redirected to http://www.mydomain.com/* and this is not the case! There is no redirect.

I think the problem is that Instead of deploying your small nodejs file that does the redirect, it is deploying my app (which is current folder). I am using [email protected] and it seems that it is ignoring the custom path :/

Am I doing something wrong ?

Only solution I have now is deploying my app and then aliasing it to both domain: now alias https://mydomain-gfhsgtwezq.now.sh mydomain.com now alias https://mydomain-gfhsgtwezq.now.sh www.mydomain.com which is working.

pierregoutheraud avatar Sep 11 '17 15:09 pierregoutheraud

i would also want to know. My goal is the same but why it creates a new alias ?

flieks avatar Sep 12 '17 15:09 flieks

i would recommend not running this app from within an existing now deployment directory, as i'm not sure but the results would seem not well-defined.

transitive-bullshit avatar Sep 12 '17 20:09 transitive-bullshit

@transitive-bullshit thanks. So should we fiddle with records in now cli to get the forward working or there exists some command like this? now-redirect mydomain.com www.mydomain.com

flieks avatar Sep 13 '17 09:09 flieks

you'll have to run now-redirect and then run now alias like in the readme. the first one sets up a new dummy deployment that just redirects traffic. the second step, now alias makes it so traffic going to your redirected domain goes to the deployment you just setup.

(from readme)

# Generate & deploy app that redirects all inbound requests to www.example.com
now-redirect www.example.com

# Alias deploymentUrl from the previous command to the URL that needs redirected
now alias [deploymentUrl] example.com

# Congrats! Requests to example.com will be redirected to www.example.com

transitive-bullshit avatar Sep 13 '17 09:09 transitive-bullshit

@flieks @pierregoutheraud see #5 as I believe this is why you're having trouble getting now-redirect to work.

transitive-bullshit avatar Sep 13 '17 09:09 transitive-bullshit

thanks so this is just skipping one step. so now redirect does:

  • deploy to a zeit link
  • alias that zeit link to your domain ?

it's probably better for us to redirect the domain with a domain record..

flieks avatar Sep 13 '17 12:09 flieks