Skip to content

[FEATURE] Template option to limit redirects only to the same protocol #5887

Description

@JaneX8

Describe your feature request

I would like an option in nuclei-templates to restrict redirects to the protocol it was initialized with. I have a situation where I want to follow redirects (x times) but not when its switching to another protocol.

How can I ensure that redirects are only on the same protocol (eg http or https) and not switching protocols?

Right now I use something like:

requests:
  - method: GET
    path:
      - "http://{{Hostname}}/something"
      - "https://{{Hostname}}/something"

To ensure I test both, both can redirect but only within their own protocol.

Describe the use case of the feature

Generic, many use cases thinkable.

Describe alternatives you've considered

requests:
  - method: GET
    path:
      - "https://{{Hostname}}/something"
  - method: GET
    path:
      - "http://{{Hostname}}/something"

But still no way to limit redirects to their own protocol.

Additional context

In addition to the existing redirect controles like:

    redirects: true
    host-redirects: true
    max-redirects: 3

I propose:

    redirects: true
    host-redirects: true
    max-redirects: 3
    protocol-redirects: true # < Default true to stay backwards compatible

Then by using protocol-redirects: false this behavior could be disabled.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: EnhancementMost issues will probably ask for additions or changes.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions