0

I have been stuck with this issue for a while and getting desperate for some helps.

I am currently building a website with NodeJS and I am using AWS EC2 with Pound for routing configuration. For one part of the website, I want to redirect the visitor to an external website (e.g.: google.com) by using node res.redirect("http:// google.com"). However, this keeps getting redirected back to my homepage.

My understanding, it goes like this:

  1. Visitor goes to a my certain url (http:// home.com/test)
  2. In my NODE route, I use GET for 'test' and use res.redirect("http:// google.com").
  3. The server routes back to my homepage (http:// home.com)

If I try to use res.redirect('http:// google.com/something'), it will get redirected to http:// home.com/something.

This redirection works just fine in localhost (e.g. the user is able to reach the external URL), which means that this has something to do with my AWS EC2 or POUND configuration.

Has someone experienced this before and has a solution? Thank you very much!

Note: The space between 'http://' and the URL in this question is intended so they don't become a Link here. The space does not exist in my implementation.

4

1 回答 1

0

我认为这种行为是由 POUND 配置引起的,因为我放了:

监听HTTP

地址 0.0.0.0

端口 80

而我应该用服务器 IP 地址替换地址。

这在配置描述中如下所述:

地址地址 Pound 将监听的地址。这可以是数字 IP 地址,也可以是在运行时必须可解析的符号主机名。这是一个强制参数。地址 0.0.0.0 可以用作“这台机器上所有可用地址”的别名,但强烈建议不要这样做,因为它会干扰重写机制(见下文)。

有关详细信息,请参阅以下网站:http: //linux.die.net/man/8/pound

于 2016-02-10T18:12:46.483 回答