Thanks to visit codestin.com
Credit goes to github.com

Skip to content

handleTrailingSlashRedirect throws when the path is exactly // #873

Closed
@lujjjh

Description

@lujjjh

function handleTrailingSlashRedirect(
event: InternalEvent,
): false | InternalResult {
// When rawPath is `//domain`, `url.host` would be `domain`.
// https://github.com/opennextjs/opennextjs-aws/issues/355
const url = new URL(event.rawPath, "http://localhost");

The call to

new URL(event.rawPath, "http://localhost")

will throw

TypeError: Failed to construct 'URL': Invalid URL

if event.rawPath === "//" and will cause an internal server error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions