Skip to content

bug: Wrong replacement http to https for remix package #916

Closed
@nkschmidt

Description

@nkschmidt

Describe the bug

Your code has hack for Gitpod for replacement http to https (HandleSignInCallbackController.js), but it has wrong behaviour for Cloudflare. After replacement we get httpss in callbackUri instead https.

HandleSignInCallbackController.js

Expected behavior

If request url already has https we don't need replace it to https. Because after that we get mismatch redirect url error.

How to reproduce?

Just run Remix package for Cloudflare Worker.

Context

N/A

Proposal

I'm not sure that it's good approach to fix wrong behaviour third party systems in your code, but anyway for solving this problem we need check and don't replace http to https if it already contains https.

For example, we can rewrite replacement:

const callbackUri = isForwardedHttpsTraffic ? request.url.replace('http:', 'https:') : request.url;

or just add additional condition:

const callbackUri = isForwardedHttpsTraffic && request.url.indexOf('https') !== 0 ? request.url.replace('http', 'https') : request.url;

Metadata

Metadata

Assignees

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