Browsers send a lot of traffic that is not part of your test, such as analytics and fonts. Compass keeps that traffic out of your project. Every extension in Marasi uses the same scope.

Compass with a scope script and the scope tester

Write your scope

Your scope is Lua code in the Compass editor. Each rule is a regular expression that matches a host or a URL. A rule that starts with - excludes what it matches.

This example keeps two hosts and drops images and fonts from the project:

local scope = marasi:scope()
scope:clear_rules()
scope:set_default_allow(false)

scope:add_rule([[^(www|api)\.example\.com$]], "host")
scope:add_rule([[-.*\.(png|jpg|woff2?)$]], "url")

function processRequest(request)
	if not scope:matches(request) then
		request:skip()
	end
end

function processResponse(response)
	if not scope:matches(response) then
		response:skip()
	end
end

You choose what happens to traffic that is out of scope:

  • skip() sends the request on, but Marasi does not save it.
  • drop() blocks the request. It never reaches the server.

Apply your changes

  1. Open the Marasi menu.
  2. Select Update Compass Code.

Marasi runs the code and shows Updated Compass. New traffic follows the new scope.

Test a URL

  1. Click Compass Settings.
  2. In the URL box, type a URL, such as https://api.example.com/v1/users.
  3. Click Test Rules.

The result shows if the URL is in scope and which rule matched it.

Next step

Hold and change traffic with Checkpoint.