Placing Cortona3D Solo library on a web server
Updated on 13th February 2023
The article is applicable to RapidAuthor version 12 and above
RapidAuthor can produce publications that do not require browser plugins. These publications can be viewed with Cortona3D Solo, which is based on WebGL and HTML5 technologies.
To organize a proper Web portal architecture, it is recommended to place the Cortona3D Solo Library in a dedicated location on the server. The path to Cortona3D Solo Library can be defined with the help of the “3D Viewer URL” in the RapidAuthor publish options (Tools > Publish Options) or in specification components using RapidDeveloper.
NOTE. By default, the Cortona3D Solo Library is placed into the resource folder of the RapidAuthor publication. If you have a substantial number of publications you will have to update the Cortona3D Solo Library for each publication when a new version of Cortona3D Solo Library is released. Moreover, multiple copies of the library will take extra disk space and your users will have to download it for each publication, so it is not recommended to use the default option for mass production.
Please, follow these steps:
- Publish any demo project of RapidCatalog or RapidManual to an empty folder with the default publish options (“Use Browser Plugins” = “No”, “3D Viewer URL” = <empty>).
- When using custom specifications, publish one project for each custom specification to the same folder with the options specified as “Use Browser Plugins” = “No”, “3D Viewer URL” = <empty>.
- Place the content of the “res” subfolder (Publication folder) on a web server for public access. For example, http://shared.customer.com/res/.
- Apply the web server settings described below (CORS and MIME types).
- Set the “3D Viewer URL” publish option in RapidAuthor to “http://shared.customer.com/res/” for all specifications you are using for your projects and publish your projects with this option.
- The path specified in the “3D Viewer URL” publish option should end with a forward slash “/”.
- The “3D Viewer URL” publish option is ignored in the RapidAuthor preview mode.
Instead of defining the URL to Cortona3D Solo in the RapidAuthor publish options you can create a custom specification component and specify this URL there as a default value or permanently. The custom specification component can be created with the RapidSpecification module of RapidDeveloper. All existing projects should be then opened with the custom specification component. This method is recommended if you have a big team of authors and would like to ensure that publications created by different authors use the same URL.
Web server settings
Your web server should be able to use the cross-origin resource sharing (CORS) for the files *.js, *.wasm, *.js.mem, *.json, and *.data from http://shared.customer.com/res/.
The information about CORS activation on various servers is available here: https://enable-cors.org/server.html
.htaccess
<IfModule mod_headers.c>
<FilesMatch "\.(json|data|js|wasm|js\.mem)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
web.config
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
The MIME type “application/octet-stream” should be used for the files *.js.mem and *.data.
If the content is published as a cortona3d viewer bundle (publish option “Viewer Bundle” not set to “None”), the MIME-type “application/x-cortona3d” should be additionally configured for the *.cortona3d files.
Please note that if you use the Microsoft IIS web server, it needs to be configured to return files with the .mem and .cortona3d extension. This is not a standard extension and your server may block it and return an error 404 when such a file is requested by a client.
Starting from release 14.1: the MIME type “application/wasm” should be reported for *.wasm files.
web.config
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mem" mimeType="application/octet-stream" />
<mimeMap fileExtension=".cortona3d" mimeType="application/x-cortona3d" />
<mimeMap fileExtension=".data" mimeType="application/octet-stream" />
<mimeMap fileExtension=".wasm" mimeType="application/wasm" />
</staticContent>
</system.webServer>
</configuration>
If the Cortona3D Solo Library files are supposed to be regularly updated on the server, it is recommended to use the no-cache caching directive.
.htaccess
<IfModule mod_headers.c>
<FilesMatch "\.(json|data|js|wasm|js\.mem)$">
Header set Cache-Control "no-cache"
</FilesMatch>
</IfModule>
web.config
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="no-cache" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>