Skip to content

Protocol redirect (mailto, ...) are not handled correctly #5002

Closed
@lkwr

Description

@lkwr

What version of Remix are you using?

1.9.0

Steps to Reproduce

npx create-remix@latest with cloudflare pages and typescript

Adding a loader into the generated index file:

export const loader = () => {
  return redirect('mailto:user@example.com');

  // Also not works
  // return Response.redirect('mailto:user@example.com');
  // return new Response(null, {status: 302, headers: {"Location": 'mailto:user@example.com'}})
};

Expected Behavior

Open http://localhost:8788/ should redirect to mailto:user@example.com and the browser open a mail client.

Actual Behavior

Remix redirects to http://localhost:8788/mailto:user@example.com when visiting http://localhost:8788/

When inserting the same code from the loader directly into the server.jsfile, everything is working as expecting. Remix change the redirect location from a redirect response but this change is wrong in case of a mailto URI. There should be a better detection for protocols URIs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions