{urlload} in staging account

When I try to use a dynamic url in {urlload} I get the following error:

{urlload} URL must have a fixed domain like "https://example.com"

Is it possible to have dynamic urls for urlload for things like staging vs production?

Hey @Josh_McKenney , the fixed domain is important to accurately determine the host permissions required in a snippet. You have two options for dynamic domains:

  1. Use an if-condition to decide between the two:

{staging=yes}
{if: staging = no}
{urlload: https://example.com}
{else}
{urlload: https://staging-example.com}
{endif}

This doesn't behave nicely if your urlload has a lot of parameters, because you'll need to duplicate all of them twice.

  1. Note that only the domains need to be fixed (and the routes can vary). So, if you own the website, setup a custom route, such as https://example.com/staging/ that has a 3xx redirect to https://staging-example.com while internally forwarding the request query/body/etc. Then use it in the snippet like so:

{staging=yes}
{if: staging = no}
{route="/"}
{else}
{route="/staging/"}
{endif}
{urlload: https://example.com/{=route}}

This doesn't work if you don't own the website. it also might be slightly more complicated to set this up depending on your website. I haven't actually tested this myself, so there might be some other issue as well that I am missing.