Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server returns http 400 when connected to SSID with password #819

Open
jbrepogmailcom opened this issue Jan 31, 2019 · 9 comments
Open

Server returns http 400 when connected to SSID with password #819

jbrepogmailcom opened this issue Jan 31, 2019 · 9 comments
Labels
Incomplete Did not use form or provide enough information

Comments

@jbrepogmailcom
Copy link

Hello, I have noticed following strange behavior.

I have multiple SSIDs provided by my home ZYXEL router, some with password, some without it. I use WiFiManager.h to autoconnect to SSID. When it does not detect connection, it launches captive portal, where I can select some of my SSID, enter password and ESP then connects to that SSID.

Then I use OTA from web server, with ESP8266HTTPClient.h and ESP8266httpUpdate.h. I noticed that when I am connected to SSID with password, I can not connect to OTA server and it returns http code 400. When I reconnect to other SSID without password, then OTA server returns http code 200 and server the update file.

Jan

@tablatronix
Copy link
Collaborator

SO when your esp is connected to an anoymous ap it works, and when its connected to a secure ap it doesn't ?

and have you tried this without wm , because it doesn't sound like anything to do with wm.
Sounds like a subnet or ip routing problem

@jbrepogmailcom
Copy link
Author

Yes exactly. It could be a problem of internal ZYXEL routing, because SSIDs have different MAC addresses.

However, when I tried HttpClient example from Arduino library that does not use WM, it connects to server correctly through both secure and insecure AP. My example with WM only connects to web server when connected to insecure AP (without password). I can send you problematic sketch, but not over this issue management, it would make messages hard to read.

@tablatronix
Copy link
Collaborator

Are you setting mode(WIFI_STA) explicitly, and making sure it is not falling back to STA_AP ?

@jbrepogmailcom
Copy link
Author

In Arduino example yes and it works. In my sketch that uses WM there is no such setting, I connect with following code. It works well and does connect to AP (but not to http server, only with empty password). By the way, I had troubles with secure SSID earlier, I discovered I was using beta version of JSON library. I could not connect to secure SSID. When I downgraded JSON library, then secure SSID connection started to work.

Serial.println("Setting WiFi connection..."); delay(100); pinMode(LED_ESP, OUTPUT); ticker.attach(0.6, tick); WiFiManager wifiManager; wifiManager.setAPCallback(configModeCallback); if (!wifiManager.autoConnect(D_Name)) { Serial.println("failed to connect and hit timeout"); ESP.reset(); delay(1000); } Serial.println("connected...yeey :)");

@tablatronix
Copy link
Collaborator

that is the only thing I can think of, that the esp is being left in the default sta ap mode and you are not changing it in your code. This could cause issues with connecting to some aps, set mode explicitly in your code to what you need it to do

@jbrepogmailcom
Copy link
Author

Does "wifiManager.autoConnect()" set STA mode itself? Or how do I do it? Googling did not help much...

@tablatronix
Copy link
Collaborator

WiFi.mode(WIFI_STA);

@jbrepogmailcom
Copy link
Author

I have added it after autoConnect():
WiFi.mode(WIFI_STA); Serial.println("connected...yeey :)");

but the problem remains, http GET only works with SSID without password. With password, server returns 400 (error -11).

Interesting is that GET and telegram check connection DOES NOT work, while BLYNK sending parameters DOES work even with secure SSID...

@tablatronix
Copy link
Collaborator

If you want to provide all the information in the issue form I can look into it.

You can try the development branch and see if it already been fixed

@tablatronix tablatronix added the Incomplete Did not use form or provide enough information label Feb 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Incomplete Did not use form or provide enough information
Projects
None yet
Development

No branches or pull requests

2 participants