As front-end development, remote testing is essential. Most of the time we only do Intranet tests for convenience, that is, within the same LAN, you can access the service you are enabling by using localhost or 127.0.0.1. However, some functions must use the Internet to complete the test, but you can’t build an Internet server for a test. You can use the Intranet penetration tool to access a server that is enabled locally from the Internet.

Localtunnel (foreign network)

Localtunnel is an open source project that exposes Intranet servers to the public network

1. Installation, based on nodeJS environment, from the NPM global installation

$ npm install -g localtunnel

2. Start the local server

$ localhost:8080

There are many ways to start a local server, such as Apache, Nginx, IIS;

PHP: $PHP -s localhost:8080laravel: $PHP artisan serve 8080python3: $ python -m http.server 8080python2 : $ python -m SimpleHTTPServer 8080Copy the code



3. Enable the Localtunnel service



1) The specified port number –port 8000 must correspond to 8000 of localhost

2) –subdomain mitu: specifies the prefix mitu

3) LT is short for localtunnel

4. In the end, the outer web browser can enter https://mitu.localtunnel.me to visit local localhost: 8000, it is important to note that localtunnel server is abroad, sometimes visit may not be ideal


Natapp (Domestic website)

Official website: natapp.cn/, enter the official website to register an account

1. Access the user center



2. You can purchase different tunnels with different functions, such as binding your own domain name, which are described in detail. After purchasing the tunnel, there is detailed information in “My Tunnel”. Pay attention to authToken, which will be used later when configuring the client.


3. In the right pane, you can configure the specified port. The default port number is 80



4. Download the client software as required



5. Download and decompress the natapp.exe file and download the config.ini file natapp.cn/article/con… Ini and natapp.exe in the same directory and open config.ini to add authToken (authToken in my Tunnel when purchased)



6. Run $natapp in the natapp.exe directory



http://i4fdpf.natappfree.cc – > 127.0.0.1:8000, Local service mapped to http://i4fdpf.natappfree.cc, the network can request http://i4fdpf.natappfree.cc to access to the local localhost: 8000, Notice In this case, the localhost:8000 service must be enabled locally.


            

Conclusion:

1. Both tools need to enable the local service, and then map through the port number (default 80 when omitted) of the

2. The configuration of localtunnel is simple, but the access of the foreign server is sometimes unsatisfactory

3. Natapp is a domestic server, but the configuration is relatively complicated