Replacing image url prefix using a variable

looking at this video Headless Strapi Integration - Divhunt No-Code Web Builder - YouTube
I’m also using Strapi, but will change the strapi I’m using in dev to one in prod, hence the image prefix will change.
Thus I want to have a single place (a variable or function) where I’ll setup the value in the prefix. I’ll call it instead of the Replace function used in the video example.

How can I add & use this function or variable?

Hi @xmasrock

I’ve added variable for strapi ($strapi) as object, for now it contains the endpoint. To access endpoint > ${strapi->get(‘endpoint’)}

1 Like


Also to mention, there’s 2 ways to access variables

If you are only displaying the value of variable, you can use following:


But if you want to connect 2 values inside same input field then use {}

${strapi->get('endpoint')} - some text here if neede - ${blog->get('image')}

1 Like

@dejan : when trying to use ${ … } in the UI, I can’t add the last “}”


Sadly we don’t have UI that can combine 2 variables yet into single input field.
What you can do is use UI to get both values and then wrap both values in brackets {}

For example if you have used UI to get $strapi->get(‘endpoint’) then wrap it manually to ${strapi->get(‘endpoint’)}

Then do the same for URL and merge both strings into text input field.

Could you share your domain name and I can help you do that?

My domain is “temlab”


Most often request fail to execute on

Is there any type of limit on your end?

I’m suspecting to have put a limit on their “free” domain names. I’ll try to change it with the IP address


We are not allowing IP address as URL.
Give us some time to investigate why is this happening. It may be our servers limit.

Thanks for patience.

Also regarding UI for variables, we will be updating with new and improved UI soon.

I see changes happening from time to time :rofl:

while I’m in the Rest-API screen, it’s a bit strange to have an “update” button on the different sections (PARAMS, HEADER, …) and not on others


Most of our system is based on auto-save, so we could also add those (params, headers) to be autosave too, would that work for you?

Also seems like domain is no longer working, I am trying to determine what was issue.

@dejan : I confirm that the data is not retrieved right now.
I’ve tested with Postman and it works well.


I can’t get that endpoint to work at all. I asked also few people to test it, they all get same error, “could not resolve host”.

Yes that’s because I’m shutting down strapi when I’m not on this project. We need to synchronize for tests :wink:

strapi env running and responding

I’ve put this into a paragraph


It’s not working, the first variable is ignored

the combined is now working with just :slightly_frowning_face:

however, when using this on <img src= seems not working:

Looking at the generated site, the prefix is removed: