Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 从我的节点访问代理服务器地址?_Node.js_Nodemailer_Req - Fatal编程技术网

Node.js 从我的节点访问代理服务器地址?

Node.js 从我的节点访问代理服务器地址?,node.js,nodemailer,req,Node.js,Nodemailer,Req,我正在使用NoEmailer发送一封关于我的项目的确认电子邮件, 像这样: var mailpoptions={ 来自:alex@account", 发送至:req.body.email, 主题:“帐户验证令牌”, html:`您好,请单击链接验证您的帐户\n` }; 我正在发送一个href链接,其中包含req.headers.host,它是我的节点地址localhost:6000,但我希望它是我的react address localhost:4000,因为它稍后会更改,我希望有一个变量js

我正在使用NoEmailer发送一封关于我的项目的确认电子邮件, 像这样:

var mailpoptions={
来自:alex@account",
发送至:req.body.email,
主题:“帐户验证令牌”,
html:`您好,
请单击链接验证您的帐户

\n` };

我正在发送一个href链接,其中包含req.headers.host,它是我的节点地址localhost:6000,但我希望它是我的react address localhost:4000,因为它稍后会更改,我希望有一个变量jst,如req.headers.host,它将包含我的react客户端地址,是否可能?或者我需要手动设置它?

如果应用程序不是服务器端呈现的,您可以从前端传递React客户端的地址,并将其包含到您的请求对象中,然后在它到达服务器后检索

我找到了答案,我可以使用变量:

const addr = `req.headers.referer`
const addr = `req.headers.referer`