• Система автоматизации с открытым исходным кодом на базе esp8266/esp32 микроконтроллеров и приложения IoT Manager. Наша группа в Telegram

ESP8266 + Apache local server = 400 Bad Request

jakubST

New member
Hello!

I'm using ESP8266 with actual firmware ESP8266_NONOS_SDK_V2.0.0_16_08_10.
I do database query to PHP + MySQL using at commands.

On Internet network

... ESP8266 works fine for example: http://zzzzzzz.zzzzzzzzz.zz/dodaj_rek.php?n=129&u=1488723073&d=-51&s=203


AT+CWMODE_CUR=3
AT+CIPSTART="TCP","zzzzzzz.zzzzzzzzz.zz",80
AT+CIPSEND=89
GET dodaj_rek.php?n=129&u=1488723073&d=-51&s=203 HTTP/1.1\r\nHost: zzzzzzz.zzzzzzzzz.zz\r\n\r\n

server answer:

+IPD,189:HTTP/1.1 200 OK
Date: Mon, 06 Mar 2017 02:29:39 GMT
Server: Apache/2
X-Powered-By: PHP/5.3.29
Vary: User-Agent
Content-Length: 11
Content-Type: text/html; charset=UTF-8
CLOSED

and new record in database has been added correctly.


Server in local network

I installed actual version of Apache, PHP and MySQL on computer with Win10 and IP 192.168.1.51 listenning on port 80.
SSL is not enabled.

When I'm using such url:

192.168.1.51/dodaj_rek.php?n=129&u=1488723073&d=-51&s=203

in web browser of any machine (computer, smartfon, tablet) in my local network via WiFi or LAN, every thing works fine.

Problem arises when i'm trying do the same using ESP8266.

AT+CWMODE_CUR=3
AT+CIPSTART="TCP","192.168.1.51",80
AT+CIPSEND=81
GET dodaj_rek.php?n=129&u=1488723073&d=-51&s=203 HTTP/1.1\r\nHost: 192.168.1.51\r\n\r\n


AT+CIPSTART responds correctly connecting to the server
AT+CIPOSEND responds correctly showing prompt: >
After sending GET responds correctly showing:

Recv 81 bytes

SEND OK

but generates error: 400 Bad Request

+IPD,418:HTTP/1.1 400 Bad Request
Date: Mon, 06 Mar 2017 02:40:29 GMT
Server: Apache/2.4.25 (Win64) PHP/5.6.30
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br /></p>
</body></html>
CLOSED


I attach configuration files of PHP and Apache.

I spent a lot of time and I can not find the reason :(
 

Вложения

  • 28.3 KB Просмотры: 0

fandy

Member
May be better:
GET /dodaj_rek.php?n=129&u=1488723073&d=-51&s=203 HTTP/1.1\r\nHost: 192.168.1.51\r\n\r\n

??
 
Сверху Снизу