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:
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:
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:
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:
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:
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:
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
.
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.
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
.
Last updated
Was this helpful?