Subdomain Redirection for `/blog` Not Working

Hello Cloudflare Support, I have configured a Cloudflare Worker to handle redirection for a subdomain. The intended behavior is to redirect all requests to the /blog path on the main domain to the corresponding subdomain (e.g., picsht.com/blogblog.picsht.com). However, the redirection is not working as expected, and requests to the /blog path are not being redirected to the subdomain. Here are the details of my setup: - Worker Script: The script is configured to intercept requests to /blog and replace the domain with the subdomain blog.picsht.com. - Worker Route: The route *picsht.com/blog* is set up to handle these requests. - Expected Behavior: Requests to picsht.com/blog or picsht.com/blog/some-post should redirect to blog.picsht.com or blog.picsht.com/some-post. - Issue Observed: The redirection does not occur, and the request stays on the main domain. Can you please assist me in identifying and resolving the issue? If additional information is required, I am happy to provide it. I have attached the Worker routes setup and the worker code. Thank you!
No description
No description
1 Reply
Ashkan
Ashkan3d ago
possible solution, try to respond with http status code 30X (redirect status code, X is in range 1 to 8). it's possible that your browser may block your request because you try to redirect but you are sending http 200. this contradiction may result in security blocks.

Did you find this page helpful?