Skip to content

Redirect Loop Causes 414 Error in node-libcurl While Working Fine with Terminal curl #417

Open
@jatin-vl

Description

@jatin-vl
  1. Description
    I am encountering an issue where a simple GET request with automatic redirection works perfectly fine when run using the
    terminal curl command, but it results in an infinite redirect loop and eventually returns a 414 Request-URI Too Long error when
    using node-libcurl.

  2. Steps to Reproduce:
    2.1 Here is the basic setup:
    2.2 Terminal curl Request: When running the following command in the terminal:
    bash
    curl -X GET -I -L --insecure https://XXXXXX...
    The request works as expected, follows the redirects, and returns a 200 OK status after resolving the redirect.
    2.3 Now the behaviour from node-libcurl
    Initial URL: https://XXXXXX...
    302 Redirect to: https://XXXXXX.../login?ReturnUrl=%2F
    302 Redirect to: https://XXXXXX.../login?ReturnUrl=%252F
    302 Redirect to: https://XXXXXX.../login?ReturnUrl=%25252F

  3. Key Observations:
    The same URL works when using terminal curl with the -L option (follow redirects) and --insecure.
    The issue seems to be caused by improper handling of percent-encoded characters during the redirection process.
    The repeated percent-encoding during each redirect is likely causing the infinite loop and the 414 error.

    Environment:
    Node.js Version: 20.17.0
    node-libcurl Version: 4.0.0
    Operating System: Linux

  4. Additional Information:
    It seems that terminal curl correctly handles the percent-encoding when following redirects, while node-libcurl is not. This behavior
    is unexpected and leads to infinite redirects that result in a 414 error.

I would appreciate any insights or advice on how to resolve this issue or if there are specific configurations in node-libcurl that I might be missing.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions