• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Port forwarding to custom port

Q&A Forum › Category: ESP32 › Port forwarding to custom port
0 Vote Up Vote Down
Steen Spaten asked 3 years ago
If I want to access my web-server from outside I understand that I need to create a hole in the router to a port. In example 8235.  How do I specify this in the code ? in this statement AsyncWebServer server(80);  ->

AsyncWebServer server(8235);  ?? (it does  not work)
7 Answers
0 Vote Up Vote Down
William Lucid answered 3 years ago

Statement is:  AsyncWebServer server(8235);

Opening ports is not without security risks; suggest becoming aware of the security risks.  There maybe other methods of remote access with less security risks.

Have you forwarded your port in the router?
Open Ports on Your Router with Port Forwarding

You will also need to allow port thru firewall:
How Do I Open a Port on Windows Firewall?

Tool for checking if port is open:  Open Port Tester

William

0 Vote Up Vote Down
Steen Spaten answered 3 years ago

Thanks a lot for guidance. I have now implemented both the router port open(was done) and the defender firewall opening. I have contacted my supplier (TeleDenmark) and they ensured me that the port was public – so I am fumbling on – trying to make it work. You answered my question thanks. Then I must have some other issues with the port.
I am willing to test out other way to obtain remote access. Can you provide a link?

0 Vote Up Vote Down
William Lucid answered 3 years ago

I would try Ngrok; I have seen it mention in posts here on the forum; although I have not used Ngrok.  Startpage.com search for ngrok came up with this project:

How to Access ESP32-CAM Worldwide using ngrok

Port forwarding:
A port you want to open has to not be in use by another application.  I would try another port number; you will need to change your router and firewall to match the new port number.

Do you happen to be running a third-party antivirus/firewall; in addition to windows defender?  If you are; it will need port opened.  I had open both Windows Defender Firewall and my third-party antivirus/firewall.

William

0 Vote Up Vote Down
Steen Spaten answered 3 years ago

No – I’m not using a third party antivirus or firewall, but thanks for the clarfication. 
It seems to me there is a lot of configuring using ngrok. What I need is a simple access for ordinary people with no prior knowledge to IT. Anyway it’s good to be aware of different solutions. 

0 Vote Up Vote Down
William Lucid answered 3 years ago

Hi Steen,

Thought of another point with port forwarding.  When you entered the port; did you use the ip address for the ESP 32/ESP8266 server, you want to remotely connect from the outside of your network?

Point #2:  Use a cell phone browser; not on your network or a computer not on your network, put connected to the internet to connect to the ESP32/ESP8266 server  –after forwarding ports and opening firewall.  Router and firewall should use same port.

The ip address you use to connect to the your ESP server; from outside of your network, will have the form of publicIP address:PORT.  You can get your publicIP IPV4 address; by going to:  Whatismyip

Once you have port forwarding working; it is good practice to use a dynamic DNS service (some are free) you use something similar to:  weather-3.ddns.net/Weather  which is my datalogger for weather observations.  When you see my server ip address in a browser you see only weather-3.ddns.net/Weather and not the actual public ip address and port; this is called URL Masking.  For Dynamic DNS; I use noip.net

Best Regards,
William

 

0 Vote Up Vote Down
Steen Spaten answered 3 years ago

Hi William – I have been a few days on Holliday – sorry for late answer.
I got port forwarding to work. I use TDC (TeleDenmarkCommunication) and they put the IP-address public. Also I had made a configuration error.
I need to digest your reading this a little more. I will certainly consider moving to dynamic DNS. I have seen your weather station and camera – you are 6 hours offset – but how nice and working perfectly. 
Thanks for all your explanation – I appreciate it,
Best regards, Steen

0 Vote Up Vote Down
William Lucid answered 3 years ago

Hi Steen,

Glad you were able to get port forwarding working.  Good to hear you were able to access one of two web sites; powered by the same ESP32.  The one you visited has a file browser and the camera.  Second web site is a free domain hosting web site:  Hosted Domain web site

Unfortunately; the hosted web site has been experiencing a huge DDoS attack the last few days, resulting in “404” messages –web page not found.   Hosted web site has two web page created dynamically(new page) every fifteen minutes; those pages are “Observations I” and “Observations-II.”  Due to hosting service restrictions no file browsing on this site.

My apologies for getting  a little off topic of port forwarding.  Good luck with your projects Steen!

Best Regards,
William.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.