streamtool addtrustedorigin
Usage
addtrustedorigin [-d,--domain-id <did>]
[-U,--User <user>] [-h,--help] [--trace <level>]
[-v,--verbose <level>] [--zkconnect
{<host>:<port>},... | --embeddedzk]
[<origin>]
The streamtool addtrustedorigin command adds an origin to the list of origins that are trusted by the Streams REST API.
Authority
You must have write authority for the config domain object. By default, the DomainAdministrator role has this authority. For more information about access control lists, see streamtool getdomainacl.
Description
Web browsers typically restrict scripts from accessing data with a different origin than the page that contains the script. This restriction, which is known as the same-origin policy, can prevent you from directly accessing the Streams REST API from a script. To avoid this problem, the Streams REST API supports cross-origin resource sharing (CORS), which provides a mechanism for the browser and server to determine whether to allow cross-origin requests.
This command adds an origin to the list of trusted origins. You can then issue REST API requests from that origin.
See also
streamtool lstrustedorigins streamtool rmtrustedorigin
Options
- -d,--domain-id <did>
- Specifies the domain identifier.
If you do not specify this option, Streams uses the domain name that is set in the STREAMS_DOMAIN_ID environment variable. By default, that domain name is
StreamsDomain
. If you are using the interactive streamtool interface, it uses the name of the active domain for the current streamtool session or else it prompts you for the domain name.The active domain for the current streamtool session is set every time that you successfully run a streamtool command with a -d or --domain-id option. Alternatively, you can run the streamtool domain command in the interactive interface.
- --embeddedzk
Specifies to use the embedded copy of ZooKeeper. This option is not supported within the interactive streamtool interface.
If you are not using the interactive streamtool interface and you do not specify either this option or the --zkconnect option, Streams uses the ZooKeeper connection that is associated with the active domain or the domain that is specified in the --domain-id option. Streams determines which connection maps to the domain by using cached information about the domains. In this scenario, if the domain identifier is not unique in the Streams configuration cache, the command fails.
- -h,--help
- Specifies to show the command syntax.
- --trace <level>
- Specifies the trace setting. The following valid levels are
listed in order of increasing verbosity, which is to say that the
first level in the list generates the least amount of information:
off
error
warn
info
debug
trace
off
. - -U,--User <user>
- Specifies an Streams user ID that has authority to run the command.
- -v,--verbose <level>
- Specifies to provide more detailed command output. The
verbosity level can be
0
-3
, where0
disables detailed reporting and each increment provides more detailed output. - --zkconnect <{<host>:<port>},...>
The name of one or more host and port pairs that specify the configured ZooKeeper servers. This option is not supported within the interactive streamtool interface.
If you are not using the interactive streamtool interface and you do not specify this option, Streams tries to use:
- The --embeddedzk option
- The value from the STREAMS_ZKCONNECT environment variable
- A ZooKeeper connection string that is derived from cached information about the current domain.
Arguments
- origin
- Specifies an origin, which is a combination of the scheme, host
name, and port number that identifies a trusted originator of REST
API requests. For example, the origin of
https://mydomain.com:7843/path/to/index.html
ishttps://mydomain.com:7843
.