LogoLogo
  • Getting Started
  • CLI
    • Docker
    • Config.yaml
  • GUI (SOON)
  • Tunnels Types
    • HTTP/s
      • HTTP/s plugins
      • HTTP/s apps
    • TLS
    • TCP
    • UDP
  • Reservations
    • Domain
    • Endpoint
  • Troubleshoot
    • Common errors
  • Tutorials
    • Expose a local web server
    • Expose Apache/Nginx web server
    • Share files from localhost
    • Use LocalXpose with Traefik
    • Expose PocketBase backend
    • Create a custom domain name
    • Make Let's Encrypt certificate
    • Access your IP camera remotely
    • Access your Raspberry Pi remotely
    • Sync your Keepass password manager
    • Expose localhost RASA chatbot for Telegram Integration
    • Expose your local Netdata Instance
    • Testing Stripe webhook
    • Expose localhost Kubernetes
    • Expose database server (PostgreSQL)
    • Exposing local Minecraft server
    • More Tutorials
Powered by GitBook
On this page
  • Modify request headers
  • Modify response headers
  • Protected tunnel with basic authentication
  • Protected tunnel with key authentication
  • IP whitelisting
  • Request rate limiter
  • Redirect HTTP to HTTPS
  • Prefix path

Was this helpful?

  1. Tunnels Types
  2. HTTP/s

HTTP/s plugins

A list of HTTP built-in plugins that you can use in your HTTP/s tunnels

Plugin is a function that tweaks the requests before sending them to your localhost services or before the answer from your localhost services are sent to the clients, you can use these built-in plugins without touching your services.

Modify request headers

Sometimes you need modify (add or delete) the request headers before reaching your local web server, you can do that by passing --request-header or -H in short then the header you want to edit for example:

loclx tunnel http --request-header host:dev.laravel --request-header token:secret

the above command will add two headers to the request host and token, if the headers already existed in the request then they will be overwritten, in case you want to delete a specific header from the request, you will need to pass an empty value for example --request-header 'host:'.

Modify response headers

Modify response headers before sending it back to the client (e.g. browser), you need to pass the --response-header or -R in short, then the value that you want to edit, for example:

loclx tunnel http --response-header role:admin --response-header user:admin

the above command will add two response headers to the response role and user, if the headers already existed in the response then they will be overwritten, in case you want to delete a specific header from the response, you will need to pass an empty value for example --response-header 'role:'.

Protected tunnel with basic authentication

Baisc authentication plugin restricts access to your services to known users for example:

loclx tunnel http --baisc-auth user:pass

Protected tunnel with key authentication

Key authentication plugin restricts access to your services to those who have the access token only, it is ideally used in local API services, when you want to access your localhost API service from external API client (e.g. curl, insomnia, SDKs), then from your API client you can authenticate against your local API services by passing X-TOKEN header with the token value, for example:

loclx tunnel http --key-auth secureToken

Then access your local services by doing curl https://hello.loclx.io -H 'X-TOKEN:secureToken' , otherwise you will get Access Denied

IP whitelisting

IP whitelisting plugin restricts access to specific IP addresses only, you can pass CIDR format for example:

loclx tunnel http --ip-whitelist 192.168.100.3 --ip-whitelist 10.20.100.10/24

Request rate limiter

Control the number of requests per second going to your local services, it ensures that services will receive a fair amount of requests, for example:

loclx tunnel http --rate-limit 20

This will only accept 20 requests per second otherwise you will receive 429 Too Many Requests.

Redirect HTTP to HTTPS

Add requests auto redirection from HTTP to HTTPS, for example a request to http://hello.loclx.io will be redirected to https://hello.loclx.io.

loclx tunnel http --https-redirect

Prefix path

Prefix the request path with a custom path, if your tunnel is hello.loclx.io , then adding prefix path like /foo/bar will update the incoming requests URL path before forwarding it to your localhost server.

loclx tunnel http --prefix-path /foo/bar

So if the incoming request is https://hello.loclx.io/api/v1 then after the modification it will become https://hello.loclx.io/foo/bar/api/v1.

PreviousHTTP/sNextHTTP/s apps

Last updated 2 years ago

Was this helpful?