I created an automation workflow to get 2 parameters from WordPress to n8n Webhook node, after comparing the course that the user attempted to take and the courses that the user had enrolled before in Moodle, to determine whether the user needs to attend the Pre-Course or not.
The final step after IF node, I want to redirect the user to a web page of Wordpress HTTP Responses2wpN – SEE Learning Taiwan if requiresPreCourse is true. Otherwise, a popup message will be shown to indicate the user to continue taking the course.
Although the “Respond to Webhook” node after IF node executed Successfully, nothing happened at the WordPress side. Chrome dev. shows it has been blocked by CORS policy, any suggestion to fix the CORS issue?
Added option “Allowed Origins (CORS)” in the Webhook node, it seems solved CORS issue, but still can not redirect to the WordPress page expected using HTTP Request node at the end of workflow.
Configuration of HTTP Request node:
URL: HTTP Responses2wpN – SEE Learning Taiwan
(**Tested above URL in the browser successfully redirected to the page expected.)
Method: GET
Query Parameter Key: requiresPreCourseValue: true
Options Follow Redirects enabled Max Redirects: 21
Output shows “Node executed successfully” but did not redirect to the WordPress page expected.
If this is the support we are going to get, I will be very hesitate…
Below is the reply from our hosting provider:
According to my test with cURL, it seems that the Nginx server is responding with a “301 Moved Permanently” status code and includes the “Location” header with the target URL for redirection. This indicates that the Nginx server is correctly configured to perform the redirect.
Since the cURL request is triggering the redirect as expected, the issue may lie within the n8n workflow or how the HTTP Request node is handling the response. Therefore, it may be helpful to further investigate the n8n workflow or consult with the n8n support for assistance in troubleshooting the redirection problem.
Thanks for posting here and welcome to the community!
Could you share the rest of your workflow?
In order to respond with the redirect you will have to configure your webhook nodes to use the Respond to Webhook node and within that node set the redirect link.
I can’t use my account since it is still blocked by trial ended when activating “Test Workflow”, but I do need to confirm the situation so I can show the workflow to my client tomorrow, and convince them to pay for your service.
So I had asked my college to copy the workflow using his account, but the problem is same as using HTTP Request…
Output shows successfully but did not redirect to the WordPress page expected.
We’re still working on getting your trial account back online so you can keep testing this in your own instance.
How are you calling this? Make sure you use the correct path (it will be a new one, since you’re using your colleagues’ account!) and also that the workflow is active.
Please note that the webhook node behaves different in test mode. So if you went to test this with the production URL from an external source (e.g. curl) it should redirect correctly. Can you confirm this?
Also, could you perhaps share your whole workflow here here so we can take a deeper look into what you’ve got at the moment?
Tip for sharing your workflow in the forum
Pasting your n8n workflow
Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.
```
<your workflow>
```
Make sure that you’ve removed any sensitive information from your workflow and include dummy data or pinned data as much as you can!
I know there are Test URL and Production URL in Webhook node. We had run the workflow with Test URL successfully.
The problem is, it did not really redirect the user to the WordPress page expected.
the webhook is triggered when this is clicked, yes.
and Click “Take this Course” in this page will trigger the workflow successfully, but not redirect user to the target page.
You can test it using Username: test4see pw: Test4n8n1114