Beginning with Portal for ArcGIS 10.5.1, you can add custom widgets to your portal. This means that you can choose the custom widgets in the builder environment when you create the app. Before you can use a custom widget, it must be hosted on a web server and registered to your portal. For security reasons, only portal administrators can register the custom widget, and public apps will not load the custom widget when anonymous users access it.
Host a custom widget on a web server
Hosting a custom widget on a web server is no different than hosting any other web app. You need to install and configure a web server. Common web servers include IIS, OS X Server, and Apache.
To host custom widgets on your web server, complete the following steps:
- Enable anonymous access to your web server.
The hosting location must be anonymously accessible.
- Enable HTTPS.
Enable HTTPS access in your web server to avoid creating mixed content. Web AppBuilder does not allow mixed active content caused by loading HTTP under an HTTPS connection. In addition, your server should have a valid SSL certificate issued by a certificate authority to establish the HTTPS connection.
- Enable Cross Origin Resource Sharing (CORS).
Web AppBuilder runs under your portal domain, which may be different from the domain of the web server hosting your custom widget. You need to enable CORS in the web server so that access from your portal domain is allowed.
- Add a JSON handler to your web server.
Each widget consists of a JSON manifest file that describes widget properties. Some web servers do not recognize the JSON file extension by default. In such cases, you'll need to add it to your server as a new MIME type at the application or a higher level. The MIME type should have .json as the file name extension and application/json as the MIME type.
- Deploy the custom widget to your web server.
You can copy the custom widget folder to your web server. After deployment, you need to obtain the URL path to the manifest file of your custom widget. An example of a URL path to a manifest file is <server.domain.com>/<my widget>/manifest.json.
Register a custom widget
You must register each custom widget in your portal. You need to be signed in as an administrator to do this.
- In a browser window, sign in to your portal.
- Click My Content.
- Click Add Item and choose An application.
- Choose Application Extension (App Builder), and provide the URL to your manifest file.
An example of a URL path to a manifest file is <server.domain.com>/<my widget>/manifest.json.
- Click the Title box.
The title of your item will automatically populate from your manifest file. Optionally, you can manually edit the title.
- Add tags in the Tags box.
- Click Add Item.
You custom widget is now available in My Content as an App Builder Extension type.
Share a custom widget
As administrator, you can share the custom widget with groups in your organization who need to access, or the entire organization if necessary.
It is not recommended to share the custom widget item publicly. For security reasons, a public app will not load the custom widget when anonymous users access it. Further, an app will only load the custom widget that is registered in the same organization as the users who have permissions to access the app.
In My Content, locate your custom widget and share it with groups or your organization. When you open the builder, your custom widget displays under the Custom tab on the Choose Widget dialog box.
Update a custom widget
Once a custom widget has been deployed to a web server and registered as an App Builder Extension type item in your portal, the contents of the manifest file are saved in the extension item. This means that any change made to your manifest file that is hosted on a web server will not be recognized by the registered extension. It is recommended that you create a new extension rather than update the manifest file.