Webhook always delivers localhost as serverUrl

  • versions used (SonarQube): 7.1
  • error observed:
    serverUrl in webhooks is always set to localhost:9000 ["serverUrl": "http://localhost:9000/"] even when a server base url (sonar.core.serverBaseURL) is specified in sonarqube.
  • steps to reproduce:
  • Configure a webhook
  • Check serverUrl in delivery of webhook
  • Its always localhost:9000. It should be one from server base url (sonar.core.serverBaseUrl)
  • potential workaround
    N/A

Hi,

I’ve just tested in 7.1, and the serverUrl in the webhook payload perfectly reflects the configured base url. How are you trying to configure sonar.core.serverBaseUrl? Via the UI, or via sonar.properties? Because the latter will not work.

Ann

Thanks a lot for analysis, Ann.

Yes, sorry I saw that -Dsonar.core.serverBaseURL is passed an empty value when starting sonarqube. That might be the reason.

However I would still expect value set in sonarqube GUI to override the value passed while starting sonarqube.

Anyways, specifying base url in-Dsonar.core.serverBaseURL should fix my issue.

Thanks again,
Kumar

Hi Kumar,

Quick note on this:

I would recommend not setting that value that value in any file/script, but rather manage it purely via the SonarQube UI. That way the setting is persisted and well managed through any transition/upgrade.

Thanks for suggestion Nicolas. Sure, I will specify that only in UI.