The Lunar Interceptor is a core component of Lunar's architecture, enabling seamless integration with Lunar Proxy.
It provides different methodologies for intercepting outgoing HTTP/S requests and capturing responses.
The Interceptor ensures efficient and lightweight operation, and allows Lunar Proxy do its work by covering the following functionalities:
- Redirection - forward 3rd party API׳s HTTP/S requests to Lunar Proxy instead of original destination
- Only outbound traffic will be redirected to Lunar Proxy.
- To redirect Internal traffic, add the relevant host or IP to the Allow List
- Fail-Safe - recover from failures originated in Lunar Proxy and set the request as unmodified, returning it back to its original state instead. You can refer it as a fallback mechanism as well.
- See: Failsafe Mechanism
Our Interceptors are designed to run as close as possible to our user's code and need to be as light as possible so they don׳t increase any resources consumption.
The communication between Lunar Interceptor and Lunar Proxy is not encrypted (HTTP).
Agentless mode enables routing requests through Lunar’s Proxy without requiring any interceptor to be installed. More information about the Agentless mode can be found here.
How it works?
- Lunar Interceptor captures outgoing HTTP/S requests on the application layer.
- Forward the HTTP/S requests through Lunar Proxy.
- Lunar Proxy does its magic and sends the request (if needed to the original destination).
- Lunar Proxy receives the response.
- Lunar Proxy returns the response to Lunar Interceptor.
- Lunar Interceptor returns the response to the application seamlessly as expected.
In case of an error while using Lunar Proxy, the Interceptor will use the original destination instead.
Lunar designed a Failsafe Mechanism to avoid downtime or point of failure if something goes wrong between the interceptor and proxy in the rare case when the proxy is not available.
In case the pre-configured number of failed connection attempts to the Proxy was exceeded, a cooldown period will be initiated during which all the traffic will be directed to the original Provider.
If a connection still can not be restored after the cooldown period ended, then the Failsafe Mechanism will initiate another cooldown period after a single connectivity error.
By using this approach, the Failsafe Mechanism ensures that traffic flow is uninterrupted, and any possible delay is minimized. Additionally, the use of configurable cooldown and failed attempt parameters provides the flexibility to adjust the system according to specific needs.
If not configured the Failsafe Mechanism will load with the following default values
- To configure the Lunar Interceptor, refer to our Configuration Guide
During the loading process, Lunar Interceptor attempts to establish a connection with the Lunar Proxy. By default, there is no explicit indication if the connection is successful. However, in the event of an error while trying to communicate with the Lunar Proxy, Lunar Interceptor will generate an error message and print it to the
stdout. This error message serves as an indication that something has deviated from the expected behavior.
Additionally, if the interceptor is operating in debug mode, there may be additional logging or indicators provided to help identify the status of the connection to the Lunar Proxy.