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
ESP8266WifiServer timeout when requesting through external IP #8853
Comments
You can try and play with the embedded Netdump library which will eventually show the differences between your port redirect and your vpn setup. |
That sketch crashes intermittently with (decoded exception)
raw:
I tried to mimize the sketch to only contain: webServer.on("/req", []() {
static int rq = 0;
String a = "<h1>You are connected, Number of requests = " + String(rq++) + "</h1>";
webServer.send(200, "text/html", a);
});
webServer.on("/reset", []() {
nd.reset();
tracefile.close();
tcpServer.close();
webServer.send(200, "text.html", "<h1>Netdump session reset</h1>");
});
// webServer.serveStatic("/", *filesystem, "/");
webServer.begin();
startSerial(SerialOption::HTTPChar); |
Even through the crashes I was able to analyze the tcpdump on the client side and the nodemcu side: It seems that over external IP the ACKs for the HTTP body are not reaching the NodeMCU, but over a VPN they do. I'm still confused so as why it is like this. External IP (hangs on body receive)
External IP over VPN (good)
|
Note that I have a RPi also on the same network behind the same kind of port-forwarding that works just fine with the external IP, so I doubt it's anything network related. |
Maybe timeout related? |
I can confim similar problem. Connecting directly from lan works, but when try to access my esp using port forward / vpn it's not working. Page is loading very slowly, and eating whole ram of esp device |
(to the deleted message and the above) Might be useful to also record what network & firewall configuration used to pass the packets through the network. |
not sure if this will help you but building the firmware with andruino framework 4.2.1 solved the issue, the issue was present when using 2.6.3. |
I have a basic
ESP8266WebServer
that sends roughly 1000 characters worth of response viasend()
. Everything works fine when the traffic is over the local IPv4 address 192.168.xx.xx.However, I have set up port forwarding over my external IP to be directed to the NodeMCU device, and when the request is made over the external IP 87.xx.xx.xx via a device connected to the local network, the server times out during
send()
operation. Upon closer inspection, it seems thatClientContext::availableForWrite()
/tcp_sndbuf
returns0
in this case. Increasing the timeout to10s
didn't help. Seems the buffer is never available.As an additional step, I set up a VPN on the request device to make the request device's IP as 105.xx.xx.xx and made the same request. This time
ClientContext::availableForWrite()
/tcp_sndbuf
returned a non-zero value and the request was successful.Any ideas why the
tcp_sndbuf
would not work when a request is made by a device connected on the same network but via external IP that is port forwarded to my NodeMCU?The text was updated successfully, but these errors were encountered: