首页 > 解决方案 > 如何捕获我的路由器发出的 url 请求?

问题描述

我正在尝试在 Dreamhost 部署我自己的动态 DNS 服务,并按照一些指南设法使服务器端正常运行 - 当我打开一个 url 时,子域的 DNS A 记录得到更新。

但是当我将数据放在路由器上并尝试使其工作时(遵循 dyndns 或 no-ip 的标准),路由器无法更新。

这就是我所拥有的: 1. 服务器端按我的预期工作。2.路由器在使用默认服务(使用no-ip测试)更新IP时工作。3. 如果我在我的服务器上的身份验证失败,那么路由器会抛出一个身份验证失败的错误——它正在访问服务器并进行身份验证。4. 尝试记录以查看脚本是否在任何时候都被访问过,但事实并非如此。

所以我认为路由器请求的 url 与我预期的不同。我尝试使用 /、白色 /update/ 和 /nic/update/

在这一点上,我想看看路由器实际请求的是什么。启动 XAMPP,安装 Wireshark,并尝试将路由器设置为更新我自己的计算机。找到请求并找到 301 响应,因为路由器要求 /nic/update?我在 /nic/update/? 上有它。

浏览器透明地处理此重定向,但路由器似乎没有请求新的 url。可能需要弄乱 mod_rewrite 吗?

标签: xampprouterwiresharkdyndnsnoip

解决方案


正如怀疑的那样,路由器将重定向视为错误回复。在搞砸了 mod_rewrite 之后,我让它工作了。

用了这个:

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.cgi [L]

推荐阅读