geoview-core - v2.3.0
    Preparing search index...

    Function validateAndPingUrl

    • Validates a URL's syntax and tests whether the server is reachable using a simple HEAD request with file extension probe fallback.

      Strategy:

      1. HEAD → 2xx/3xx → reachable, no proxy needed.
      2. HEAD → 4xx/5xx → try file extension probe. If valid → reachable. Otherwise → not reachable.
      3. HEAD → CORS → try file extension probe through proxy. If valid → reachable + needsProxy. Otherwise → not reachable.
      4. HEAD → network/timeout → server unreachable.

      This function has no OGC/GetCapabilities knowledge. For OGC-aware validation, use validateAndPingUrl. The function never throws — all failures are returned as part of the result object.

      Parameters

      • targetUrl: string

        The URL to validate and ping

      • configProxyUrl: string = CONFIG_PROXY_URL

        Proxy URL to use when necessary (defaults to CONFIG_PROXY_URL)

      • timeoutMs: undefined = undefined

        Optional request timeout in milliseconds (defaults to none)

      Returns Promise<PingResult>

      A promise that resolves with a result object containing isValid, isReachable, needsProxy, status, and optional error