CDN Routes customization

I use Fastly as a load balancer, with two servers: a main server and a blog server. All traffic comes to the main server, but I need the ‘/articles’ route to comes to ‘/blog’ on my server. I have added this in the ‘Origins > Hosts’ section. However, I can’t change ‘/blog’ to ‘/articles’ in my secondary host for business reasons. Redirects are not relevant in this case. I tried VCL fragments but I not deep at this and lost.

We have an example of doing URL rewrites that does what you’re looking for. You will need to tailor it to your exact use case, but all the mechanisms are there.

If you’ve already seen this, can you post some of the details of what you added / changed there so we can try to help further.

1 Like

Good morning, thank you for your help. It helped me rewrite, but it started attaching me to the main host, not the blog host. I found the variable in the VCL code and tried to change the backend as shown on the screen, but I’m still attached to the main host.

@macs1756 do you have your blog host defined in your configuration? If not, you’ll need to define it and set it explicitly via the `set req.backend` call in line 4.

@aspires This is how it looks like in the VCL code, but it was created by the UI.