I just discovered that we cannot access from Salesforce any URL which contains an underscore (_). When you try to enter a URL with an underscore in remote site settings, you get the error below. I assumed there would be a simple solution to this, but after searching I've found nothing at all. Is there something obvious I missing?

enter image description here

  • Yes you cannot! You can map the url to some other as a workaround! Jun 8, 2020 at 2:51

2 Answers 2


RFC 2872 allows underscores for subdomains, as written in your example, but not all services support this nomenclature. Unfortunately, at this time, you'll need to choose a hostname and subdomain that does not include underscores. In particular, you also won't be able to reference sandboxes that include an underscore in its name, so you should avoid naming sandboxes this way.


Thanks, the funny thing I discovered is that this is easy to work around by using a named credential, there is no problem using an underscore there. You would think if Salesforce allows it in named credentials, it would allow it in remote site settings.

  • 1
    I don't think it does, throws an error later in the flow: FATAL_ERROR System.CalloutException: Invalid characters in hostname Don't seem to be able to encode it either.
    – Nonick
    Jun 10, 2022 at 8:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .