Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable following redirects #588

Merged
merged 1 commit into from
Sep 14, 2023
Merged

Add option to disable following redirects #588

merged 1 commit into from
Sep 14, 2023

Conversation

w1gs
Copy link
Contributor

@w1gs w1gs commented Sep 11, 2023

Added a new flag -dr, -disable-redirects which sets the http client to not follow redirects.
Issue: #561

Examples:
With following redirects enabled (default):
image

With following redirects disabled:
image

@ehsandeep ehsandeep linked an issue Sep 11, 2023 that may be closed by this pull request
Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

echo http://projectdiscovery.io | ./katana -dr -silent -d 1 -jsonl -ob -or | jq

{
  "timestamp": "2023-09-11T14:41:17.579283+05:30",
  "request": {
    "method": "GET",
    "endpoint": "http://projectdiscovery.io"
  },
  "response": {
    "status_code": 301,
    "headers": {
      "server": "cloudflare",
      "connection": "keep-alive",
      "report_to": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=ExR0BQBoZNCfMiLkbeYqu7pXRpKKygW93m0Y%2FFNJfIGriqKAfEYJ4zxHmNSVOdyJeCyZSFzqH%2BFc9fZkz5hyZgFq2sAHRFi3XWENgNg17pd8eJ%2FbXx4UMwvcZ7Vedk35dBUB3l4%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
      "date": "Mon, 11 Sep 2023 09:11:17 GMT",
      "x_content_type_options": "nosniff",
      "expires": "Mon, 11 Sep 2023 10:11:17 GMT",
      "cache_control": "max-age=3600",
      "nel": "{\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}",
      "vary": "Accept-Encoding",
      "cf_ray": "804ec84f5fe34430-BOM",
      "location": "https://projectdiscovery.io/"
    },
    "technologies": [
      "Cloudflare"
    ]
  }
}

@ehsandeep ehsandeep linked an issue Sep 11, 2023 that may be closed by this pull request
Copy link
Member

@dogancanbakir dogancanbakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ehsandeep ehsandeep merged commit 5e84d3d into projectdiscovery:dev Sep 14, 2023
13 checks passed
@cyal1
Copy link

cyal1 commented Oct 29, 2023

Can both 301 and 200 responses be saved when following redirects?

@cyal1
Copy link

cyal1 commented Oct 29, 2023

Can both 301 and 200 responses be saved when following redirects?
the endpoint http://projectdiscovery.io response status_code is 301, not 200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for not following HTTP redirects Add Follow Redirect Flag, like httpx
4 participants