Access to an HTTP resources

This section will show you how to make an HTTP service available through Border0 using your single sign-on credentials.
We'll walk through a few examples.

  • using the Border0 built-in webserver
  • making an internal web service available through border0

using the Border0 built-in webserver

Let's start with creating a socket of type HTTP.

border0 socket create  \
   --type http \
   --name "my-http-service" 

📘

Access Policy

Note that the default organization-wide policies will be applied. Optionally you can add additional existing policies to your service like this
border0 socket policy attach -s <socket_id> -n <policy_name>

Next, connect your service to Border0.

border0 socket connect \
   my-http-service \
   --httpserver

Now your service is available. You should be able to access it via the URL printed when you created the service.
The screen you see now is the built-in default web server. Useful for troubleshooting.

Now let's point the HTTP web directory to location on your host. For example:

mkdir /tmp/webfolder &&  touch /tmp/webfolder/file_3 /tmp/webfolder/file_2 /tmp/webfolder/file_1

border0 socket connect my-http-service \
  --httpserver --httpserver_dir /tmp/webfolder

This will show you a directory index of all files in this directory.

📘

Tip: add an index.html

Add a simple index.html file to this directory so the webserver will serve up the index file instead of the directory index.

Making an internal web service available through border0

Next up, let's say you have an internal web service you'd like to make available through Border0. This will eliminate the need for a VPN and give users easy Single Sign-on Access to your web service.

Using the --host and --port flags, you can control where HTTP, or HTTPS traffic should be sent to.

For example, if you have a web service running on localhost port 8000, you can make this service available like this.

border0 socket connect \
  my-http-service  \
  --host localhost -p 8000

📘

you can start a quick local web server with python

$ python3 -m http.server
Serving HTTP on :: port 8000 (http://[::]:8000/) ...
::1 - - [03/Oct/2022 20:10:01] "GET / HTTP/1.1" 200 -

Making an external web service available

In the example above, we used localhost (127.0.0.1) as the origin for the web service. We can use any DNS name or IPv4 address and port number. If you're using HTTPS as an upstream source, you'll need to configure this when creating the socket. In the example below, we'll use https:// www.bbc.com/ as an example origin. We'll make this available through Border0.

 border0 socket create \
  --type http \
  --upstream_type https \
  --upstream_http_hostname www.bbc.com \
  --name bbc 

and connect

border0 socket connect \
    bbc \
    --host www.bbc.com --port 443

You should now be able to visit the BBC web page, through border0, with authentication and authorization.

👍

Private Resources

Replace bbc.com with your internal web service by providing the internal IP or hostname instead.

Session recording

Optionally, session recording for HTTP sessions can be enabled in the portal, as can be seen in the image below.

2000

After that, you can see session recordings in the sessions tab of this socket. An HTTP session recording will show you the rendering of the HTTP DOM data. And can be replayed as a movie in the Border0 portal. See below for an example.

1920