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

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

loclx tunnel http --basic-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.


8 The Green, Dover, Delaware, 19901 USA

hello@localxpose.io

xLab

2024. All Rights Reserved

We contribute to Stripe's Climate program!

Product

FeaturesPricingDocumentationAppsAlternatives