Skip to content

Allow redirects where Access-Control-Allow-Origin header is restrictive #327

@hjhart

Description

@hjhart

Similar issue to #320, but it is slightly different.

I want to be able to handle external redirects to servers that do not have open Access-Control-Allow-Origin headers. I don't think there is a bug in the code, but I'd like to know where to hook in inside my android app to pop-up a CustomTab or something like that.

Here is an example of what I'm looking for:

Screen.Recording.2024-04-03.at.2.51.59.PM.mov

The external redirect works when it goes to https://turbo.hotwired.dev because of it's open Access-Control-Allow-Origin header.

~ ❱ curl -I https://turbo.hotwired.dev                                                                                                                                                                                                                                                                                                                            13:43:19
HTTP/2 200
...
access-control-allow-origin: *
...

The important bit in those headers is that access-control-allow-origin is set to allow all domains. But how should the turbo-android package handle it if we don't have access to set those headers (on, say, a third-party provider)? One option is to set up a proxy, but I'd love to avoid setting up any new infrastructure, as this works perfectly fine in a browser.

I'm working off of main on turbo-android (version 7.1.2), and using this server running locally: https://github.com/hjhart/turbo-native-demo

I think I should be breaking out of turbo, but I don't seem to have the proper hooks firing to do so (shouldNavigateTo doesn't fire, for instance).

Any input?

cc @jayohms I created a new issue since the previous issue was addressed and closed!

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