423
Views
7
Comments
How do I get base url ?
Question
Application Type
Reactive

How do I get the base url of my app inside an expression in a server action? I just need it to print "https://mydomain-dev.outsystemsenterprise.com/" or "mydomain-dev.outsystemsenterprise.com"

2023-12-14 09-56-57
Yogesh Javir

Hey @Daniel Johnson ,

If you are comfortable with java script then try below code in javascript widget and return output 

let url=$public.BuiltinFunctions.getBookmarkableURL(); let domain = (new URL(url)); $parameter.out = domain.hostname;


The above code will return

https://mydomain-dev.outsystemsenterprise.com


Thanks,

Yogesh

2025-08-03 07-20-35
Mythily - EONE

Hi,

You can simply use the below line of code,

Substr(GetBookmarkableURL(),0,Index(GetBookmarkableURL(),GetOwnerURLPath(),0,searchFromEnd:,ignoreCase:))  

But this line of code will work in Client action.


Thanks

2022-01-13 08-29-52
Saravanan Santhanam

Hi Daniel Jonson,

Please go through the below Link.

The GetRequestDomain action from the HTTP handler extension will solve your purpose.

https://success.outsystems.com/documentation/11/reference/outsystems_apis/httprequesthandler_api/#GetRequestDomain

I hope this helps!

Regards,

Saravanan Santhanam.

2024-05-30 10-12-48
Anushka singh

Hello

To get the base URL of your application in OutSystems, you can use the GetOwnerURL system action. This action provides the base URL at runtime 

Name the action GetBaseURLAction.

Add an output parameter BaseURL of type Text 

Drag and drop the GetOwnerURL action into the server action flow.

Assign the GetOwnerURL.Url output to the BaseURL output parameter.

 i hope it's helps!

2021-11-12 04-59-31
Manikandan Sambasivam

Use GetBookmarkableURL()

2024-06-12 08-10-25
Zeeshan Khan

Hello @Daniel Johnson ,

You should use the built-in GetServerURL function it will provide the base URL of the current environment, including the protocol and domain. 'GetServerURL() '

and if you need to use the base URL inside an expression you can call the function directly within the expression for eg: "The base URL of the application is: " + GetServerURL()

Thanks...

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.