Dashboards & Visualizations

Is there a URL Prefix variable in Simple XML?

jamesvz84
Communicator

Hello,

I am trying to link to a python controller from a simple xml html panel. I want to get the URL prefix, http://localhost:8000/, dynamically and not have to hard code it. In simple xml, is there a variable for the URL prefix (similar to {{SPLUNKWEB_URL_PREFIX}} in javascript)?

    <form>
    ....
  <row>
    <panel>
     <html> <a href="http://localhost:8000/en-US/custom/test_app/testcontroller">Link to controller</a>   </html>
    ...
  </panel>  
  </row>
    </form>
0 Karma

LukeMurphey
Champion

I would recommend switching to a relative path. That way, the view will work even if the server IP or port changes, if it uses a different language, or a custom root endpoint.

Below is a modified version that should work for you:

    <form>
  ...
  <row>
    <panel>
     <html> <a href="/custom/test_app/testcontroller">Link to controller</a>   </html>
 ...
  </panel>  
  </row>
    </form>

markthompson
Builder

I totally agree, in this day and age, no link should be hard coded, all should use a relative path. Browsers are now intelligent enough to detect that all you want to do is use the same root URL but with a different path on the end.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...