Skip to content

Access to fetch at external_redirect_url from origin our_url has been blocked due to CORS policy #320

Closed
@hjhart

Description

@hjhart

Expected behavior:

When tapping on a link that redirects to an external site
The external site should load correctly

Actual behavior:

Screenshot 2024-03-13 at 3 39 44 PM

"Error loading page" screen

Along with this in the Logcat output:

WebFragment onVisitErrorReceived() error code 0
[INFO:CONSOLE(0)] Access to fetch at 'https://our-app.formstack.com/forms/redacted' 
(redirected from 'http://app.android-local.dev-hellobrightline.com:3000/formstack/forms/3f76559e-bb49-4465-a7ab-ab4e75b80f29') 
from origin 'http://app.android-local.dev-hellobrightline.com:3000' has been blocked by CORS policy:
 No 'Access-Control-Allow-Origin' header is present on the requested resource. 
If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.", 
source: http://app.android-local.dev-hellobrightline.com:3000/formstack/forms/3f76559e-bb49-4465-a7ab-ab4e75b80f29 (0)

Isolating the problem further, if instead I have the original link pointing to https://our-app.formstack.com/forms/redacted instead of http://app.android-local.dev-hellobrightline.com:3000/formstack/forms/3f76559e-bb49-4465-a7ab-ab4e75b80f29, it works just fine. The introduction of the redirect seems to break it.

I noticed the CORS error in firefox and chrome, and disabling turbo fixed the request since it stopped being a fetch via turbo.js. Now it's happily a link that redirects successfully. But in our turbo-android app, it is still failing.

Since I don't have control over the formstack servers, I cannot modify the CORS headers successfully.

I'm going to continue to dive into this issue, but wanted to post it here for posterity, and to hopefully get some help from anyone who has encountered this issue previously.

Thanks in advance.

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