Open TCP connection oddities
Posted: Thu Feb 11, 2021 3:27 am
When setting up the ESP32 to fetch a web page, I use this command:
AT+CIPSTART="TCP","www.mydomainnamegoeshere.com",80
Started.
Requesting URL.
AT+CIPSEND=13
GET /a1.txt
it does successfully open the connection to the website.
HOWEVER: in reality it is opening a connection to the TCP address of that domain name AND NOT to the actual website itself.
For example:
say www.mydomainnamegoeshere.com resolves to 9.9.11.11
and on that Windows IIS web server I have 100 websites and 1 "default" site that only responds to the IP address itself and no domain name.
default site: responds to 9.9.11.11
all other 100 sites: respond to their unique domain name which is at 9.9.11.11 but when a web browser client requests those pages, it passes along the domain name in the request and the request is routed to the appropriate website.
then that site responds and sends back the data.
this is exactly what is going on for me.
my site is running on 9.9.11.11 but since the ESP32 is not "passing along" the domain name in the actual HTTP request, it's fetching the file from the default (IP ONLY) unused server instance instead of the site that is running the actual domain name itself.
I am SURE some of you have experienced this already. Is there any way for me to make the ESP HTTP requests properly pass along the domain name so that web servers can route the request to the appropriate domain?
AT+CIPSTART="TCP","www.mydomainnamegoeshere.com",80
Started.
Requesting URL.
AT+CIPSEND=13
GET /a1.txt
it does successfully open the connection to the website.
HOWEVER: in reality it is opening a connection to the TCP address of that domain name AND NOT to the actual website itself.
For example:
say www.mydomainnamegoeshere.com resolves to 9.9.11.11
and on that Windows IIS web server I have 100 websites and 1 "default" site that only responds to the IP address itself and no domain name.
default site: responds to 9.9.11.11
all other 100 sites: respond to their unique domain name which is at 9.9.11.11 but when a web browser client requests those pages, it passes along the domain name in the request and the request is routed to the appropriate website.
then that site responds and sends back the data.
this is exactly what is going on for me.
my site is running on 9.9.11.11 but since the ESP32 is not "passing along" the domain name in the actual HTTP request, it's fetching the file from the default (IP ONLY) unused server instance instead of the site that is running the actual domain name itself.
I am SURE some of you have experienced this already. Is there any way for me to make the ESP HTTP requests properly pass along the domain name so that web servers can route the request to the appropriate domain?