Skip to content

Add an --allow-hostnames flag #5556

@dgzlopes

Description

@dgzlopes

Feature Description

As of today, k6 supports blocking hostnames based on a list of glob-matching strings. It would also be useful to support the opposite behavior: allowing requests only to a specified set of hostnames.

Suggested Solution (optional)

Add an --allow-hostnames flag:

k6 run --allow-hostnames="api.example.com,*.example.com" script.js

Behavior:

  • Only listed hostnames are allowed
  • All others are blocked
  • Mutually exclusive with --block-hostnames

Already existing or connected issues / PRs (optional)

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions