diff --git a/docs/PxWeb2/documentation/installation-on-iis.md b/docs/PxWeb2/documentation/installation-on-iis.md index 916a844..8bed101 100644 --- a/docs/PxWeb2/documentation/installation-on-iis.md +++ b/docs/PxWeb2/documentation/installation-on-iis.md @@ -1,11 +1,12 @@ -# Install PxWebApi 2.0 on your IIS server +# Install PxWeb 2 on your IIS server -This instruction guides you in how to install PxWeb 2.0 on IIS. +This instruction guides you in how to install PxWeb 2 on IIS. ## Prerequisites - A supported Windows server with IIS installed. -- ApiUrl to your PxWebapi2 installation. +- The [URL Rewrite module](https://www.iis.net/downloads/microsoft/url-rewrite) must be installed on your IIS. +- ApiUrl to your PxWebApi 2 installation. If your tables endpoint is at `https://your.api.server/PxWeb/api/v2/tables` then your ApiUrl is `https://your.api.server/PxWeb/api/v2` (omit a trailing slash, one is added automatically) @@ -14,8 +15,8 @@ This instruction guides you in how to install PxWeb 2.0 on IIS. 1. Download the [zip file for the latest release](https://github.com/pxtools/PxWeb2/releases/latest) from GitHub. It is found inside the Asserts heading. Make sure to _Unblock_ it if its block by right clicking on it in _File Explorer_ and check the `Unblock` checkbox. -1. Put the contents of the zip file to the location of your choice. E.g `C:\inetpub\wwwroot\pxweb2`. -1. Adjust `baseApplicationPath` and `apiUrl` in `config\config.js`: +2. Put the contents of the zip file to the location of your choice. E.g `C:\inetpub\wwwroot\pxweb2`. +3. Adjust `baseApplicationPath` and `apiUrl` in `config\config.js`: ```js baseApplicationPath: "/pxweb2/" @@ -23,14 +24,44 @@ This instruction guides you in how to install PxWeb 2.0 on IIS. apiUrl: "your api url" ``` -1. In `index.html`, adjust the `` tag: +4. In `index.html`, adjust the `` tag: ```html ``` -1. I didnt need this: Ensure the web server rewrites (if needed) static file requests correctly to that subpath. +5. In `web.config`, adjust the `Content-Security-Policy` to allow calls to your PxWebApi 2 installation. Within the `Content-Security-Policy` replace the text `https://enter-your-api-domain-here` with the domain of your PxWebApi (for example https://api.scb.se): -1. In IIS find the folder and convert it to application. ( Concider using a separate Application pool for this :-) ) + ```html + + ``` + +1. In IIS find the folder and convert it to an application. (Consider using a separate Application pool for this) 1. Open "http(s)://"server adress"/pxweb2 . + +## Troubleshooting + +### Problem running PxWeb on localhost + +If you are trying to run PxWeb directly on the server under localhost you might get an error looking like this in the console of your browser: + + ``` + Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'". + ``` + +#### Solution + +Change localhost in the URL to the computer name of the server. + +### PxWeb refuses to connect to PxWebApi + +If you get an error message looking like this in the console of your browser: + + ``` + Refused to connect to 'https://your-api-url' because it violates the following Content Security Policy directive: "connect-src 'self' https://enter-your-api-domain-here". + ``` + +#### Solution + +You need to enter the domain of your PxWebApi in the Content Security Policy section in web.config, see step 5 of the installation steps above.