Search code examples
apijbase

Does jAgent support https endpoints?


We currently have some API endpoints on jAgent. These are all Http ones. I am calling these APIs from my Angular application to communicate with the jBase backend. We just hosted the Angular app on Https with a Self-signed certificate only to realise the API calls fail with the error message, "The page at 'https://*' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://'. This request has been blocked; the content must be served over HTTPS."

Is there a way to make the endpoints on jAgent https so that we can resolve this?


Solution

  • You can indeed configure jAgent to use SSL so that you can serve requests over HTTPS. There's too much to copy/paste here in full but in short please refer to jAgent Administration: jAgent Configuration File and note these comments:

    ; For SSL connections, specify the path of the x509 certificate to
    ; use. When a certificate is specified, a private key must also be
    ; specified. This option duplicates the -c (--certificate) command
    ; line option.
    ;certificate = <path to certificate (.pem) file>
    
    ; For SSL connections, specify the path of the private key for the
    ; certificate being used. This option duplicates the -k (--private_key)
    ; command line option.
    ;private_key = <path to private key (.pem) file>
    

    And also please refer to jAgent Security for additional context. It is possible to specify the cert and key via command line args when running jAgent, or (recommended) to set within the config and take care to specify the config. This command illustrates both:

    jbase_agent -c cert.pem -k key.pem --config %HOME%\jagent_config