I can't connect with non-ip-address host name if User-Agent is starting with Mozilla

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.

I can't connect with non-ip-address host name if User-Agent is starting with Mozilla

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
I can't connect with non-ip-address host name if User-Agent is starting with Mozilla
I can't connect with non-ip-address host name if User-Agent is starting with Mozilla
2021-09-13 08:43:02 - last edited 2021-09-13 08:53:53
Model: RE605X  
Hardware Version: V1
Firmware Version: 1.0.4 Build 20210507 Rel. 151958

Description


If the Host header is not an ip address and User-Agent is starting with "Mozilla", The internal server in RE605X will return the following HTML, which redirects to http://tplinkrepeater.net/webpages/notice.html, the page returns 404.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="0; URL=http://tplinkrepeater.net/webpages/notice.html" />
</head>
</html>

 

The server should returns following HTML, which redirects to /webpages/login.html?v=62c60c5d on the same server to login to the wifi router. The following HTML will be returned if the host header is an ip address or User-Agent is not starting with "Mozilla".

 

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- fix bug 238411: the "v=xxxxxxxx" can be different from different versions -->
<!-- In the future, the "xxxxxxxx" may be determined by the version of the firmware -->
<!-- Currently, "xxxxxxxxx" is simply set as "62c60c5d" -->
<meta http-equiv="refresh" content="0; URL=/webpages/login.html?v=62c60c5d" />
</head>
</html>


Why it's a Problem?

I have multiple wifi router(access points) on LAN and I want to connect to them via hostname like mDNS or local DNS so I've configured static ip address for wifi router and configured mDNS to the router with other server on same LAN. It's succeed to connect to the router via mDNS hostname (checked via curl command). However, It's not possible to configure the wifi routers via mDNS hostname on browser with default configuration because of this issue. (all modern browsers have User-Agent starting with Mozilla by default.)

 

Reproduce

I've checked this problem with the following curl invocations. please replace "router ip address" with router IP address on your environment.

 

curl -H 'Host: some-mdns-domain' -H 'User-Agent: Mozilla' -v 'router ip address'
# -> returns HTTP 200 OK with "<meta http-equiv="refresh" content="0; URL=http://tplinkrepeater.net/webpages/notice.html" />"
#    The response is not good. it should be redirected to /webpages/login.html?v=62c60c5d

curl -H 'Host: 0.0.0.0' -H 'User-Agent: Mozilla' -v 'router ip address'
# -> returns HTTP 200 OK with "<meta http-equiv="refresh" content="0; URL=/webpages/login.html?v=62c60c5d" />"
#    The response is good. 

curl -H 'Host: some-mdns-domain' -H 'User-Agent: curl' -v 'router ip address'
# -> returns HTTP 200 OK with "<meta http-equiv="refresh" content="0; URL=/webpages/login.html?v=62c60c5d" />"
# The response is good. 

curl -H 'Host: 0.0.0.0' -H 'User-Agent: curl' -v 'router ip address'
# -> returns HTTP 200 OK with "<meta http-equiv="refresh" content="0; URL=/webpages/login.html?v=62c60c5d" />"
# The response is good. 

 

Workaround

Use User-Agent Switcher and change User-Agent to not starting with Mozilla like 'curl'.

  0      
  0      
#1
Options

Information

Helpful: 0

Views: 855

Replies: 0

Related Articles