n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
48.87k stars 7.75k forks source link

n8n Form redirect URL is not working #11657

Open barn4k opened 1 week ago

barn4k commented 1 week ago

Bug Description

If I set the redirect action for the new n8n form and the url is not related to the n8n site, it won't open because of the CORS policy image

To Reproduce

Example of the workflow:

{
  "meta": {
    "instanceId": "ea8ccd7cb9d9fc233a4683c7569b952c9669ba9d3ba1459d89a9944d357fa5b3"
  },
  "nodes": [
    {
      "parameters": {
        "operation": "completion",
        "respondWith": "redirect",
        "redirectUrl": "https://wikipedia.org/"
      },
      "id": "b8a1b95f-ccca-48c1-96e4-0473dc6dbf4b",
      "name": "Form",
      "type": "n8n-nodes-base.form",
      "typeVersion": 1,
      "position": [
        1580,
        680
      ],
      "webhookId": "8f2197b9-d8b9-42ec-9ae9-a16d46be1700"
    },
    {
      "parameters": {
        "formTitle": "test",
        "formFields": {
          "values": [
            {
              "fieldLabel": "label"
            }
          ]
        },
        "options": {}
      },
      "id": "f875b6c1-77f2-41ab-a89b-ef0afbea759c",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        1300,
        680
      ],
      "webhookId": "b85acb75-c3b7-4a57-9776-ffc0d3ac3a78"
    }
  ],
  "connections": {
    "On form submission": {
      "main": [
        [
          {
            "node": "Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {}
}

Expected behavior

The redirect will work or It will be possible to disable CORS policy

Operating System

cloud

n8n Version

1.65.2

Node.js Version

cloud

Database

SQLite (default)

Execution mode

main (default)

Joffcom commented 1 week ago

Hey @barn4k,

We have created an internal ticket to look into this which we will be tracking as "GHC-414"

Joffcom commented 1 week ago

Hey @barn4k,

This appears to be working for me, Can you try in production mode rather than test and let me know if that works? I think this is likely to be related to how we load the test forms.

barn4k commented 1 week ago

Same for prod url... image

Joffcom commented 6 days ago

Interesting I wonder if it is a Cloud configuration issue for the prod link, you are not loading the form in an iframe or anything are you?