Skip to main content
Version: 0.10.x

Direct Mode

Direct Mode is useful for scenarios where you want to route your requests through a proxy without altering your existing setup significantly. By simply modifying headers and the request URL, you can leverage the proxy's capabilities.

Follow these steps for setup:

Step 1: Prepare Your Request

Start with the request you wish to make, for example, https://catfact.ninja/fact.

Step 2: Add Necessary Headers

Incorporate the following headers into your request:

  • x-lunar-scheme: Reflects the original scheme of your request. For HTTPS requests, use https.
  • host: The host you intend to communicate with, such as catfact.ninja for the given example.
  • x-lunar-consumer-tag: Add the x-lunar-consumer-tag header to your requests with a value indicating the originating application or service. This header will be removed before the request is forwarded to third-party providers.

Your request now should carry these additional headers.

Step 3: Modify the Request URL

Alter the URL of your request to route through the Lunar Proxy. Use the format: http://lunar_proxy_address:lunar_proxy_port/original/request/path

Replace lunar_proxy_address with the DNS or IP of the Lunar Proxy, and lunar_proxy_port with the listening port number.

For instance, with the Lunar Proxy at localhost and port 8000, the modified URL for our example would be:

curl http://localhost:8000/fact -H "x-lunar-host: catfact.ninja" -H "x-lunar-scheme: https"

Or, with wget:

wget -qO - --header="x-lunar-host: catfact.ninja" --header="x-lunar-scheme: https" http://localhost:8000/fact"

Step 4: Execute Your Request

With the headers added and the URL adjusted, send your request. Direct Mode will ensure it's efficiently directed to the intended destination while preserving the original scheme and host.

CTRL + M