Skip to main content

Tunneling Your Local Application

GreenFrame provides an HTTP Tunneling server based on FRP, to let you expose private websites to the analyzer. With this method, you can use GreenFrame to analyze applications running locally, in a private staging server, or in your CI.

info

This method is useful only if you use --distant flag to run your analysis on GreenFrame server

Installing The FRP Client

FRP is an open-source reverse proxy similar to ngrok. GreenFrame exposes an FRP server at https://nat.greenframe.io that you can use.

The FRP client installation process depends on your OS and bash. To simplify it, GreenFrame exposes a shell script that reduces the installation to a one-liner:

curl https://assets.greenframe.io/install-frpc.sh | bash

If the installation works well, you can type frpc -v to see the version.

You can also find all releases of the FRP client on the FRP GitHub Releases page.

Usage

In your project, add a file named frpc.ini with the following content:

./frpc.ini
# Don't change the common block used to connect to our FRP Server.
[common]
server_addr = nat.greenframe.io
server_port = 7000

# Your app
[app]
type = http
local_port = 3000
custom_domains = 123.nat.greenframe.io

custom_domains must be unique, because if they are already taken by someone else, you won't be able to run analysis every time. You can for example use an uuid generator to generate a unique identifier and create your own unique domain: UUID.nat.greenframe.io

Then run the FRP client in the folder containing the frpc.ini file:

frpc

Your app should be available at the following url: UUID.nat.greenframe.io:8080.

Please note the :8080 port at the end.

Multi-Services Application

Your app may expose more than one server, for instance, your app is a Single-Page Application using an API.

If you set up tunneling only for the frontend, the app won't be able to communicate with the API exposed on localhost.

In this case, you have to tunnel both the frontend and the API and tell the frontend to use the proxied API URL.

./frpc.ini
# Don't change the common block used to connect to our FRP Server.
[common]
server_addr = nat.greenframe.io
server_port = 7000

# Your app
[app]
type = http
local_port = 3000
custom_domains = 123-app.nat.greenframe.io

# Your Api
[api]
type = http
local_port = 3001
custom_domains = 123-api.nat.greenframe.io

With this configuration, you have to set the API URL your frontend app should use, for instance by using an environment variable:

API_URL=http://123-api.nat.greenframe.io yarn start

HTTPS Support

To be documented