When the file is in place, but can’t be loaded due to security restrictions of Content Security Policy, you can provide the Jetty rewrite rules - for instance, for the Swagger (OpenAPI) definitions.
Provide the configurations in the file named jetty-rewrite-rules.xml that resides in the following directory:
For example:
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.HeaderRegexRule">
<Set name="regex">^(?!/LyciaWeb/FormBuilder)(?!/LyciaWeb/esapi)(?!/LyciaWeb/res)(?!/LyciaWeb/tmp).*$</Set>
<Set name="headerName">Content-Security-Policy</Set>
<Set name="headerValue">default-src 'self';</Set>
</New>
</Arg>
</Call>
Now this rule dismisses the Content Security Policy header for:
You may need to change the default Lycia ports for http (9090) and https (9443). To do that, provide the configuration by defining new ports in
or
For example:
jetty.http.port=5555
Restart Jetty after this action.
After that, the URL for running Lycia applications will look as follows:
http://localhost:5555
You also may get rid of port definition in the URL by defining the default HTTP port:
jetty.http.port=80
In that case, the URL will have the following format:
http://localhost
To define custom port for HTTPS scheme, change following parameter in start.ini. For example:
jetty.ssl.port=7777
To use HTTPS URL without a port definition (https://localhost), add the line jetty.ssl.port=443 to
or
To reduce the URL size for application launch from
http://localhost:9090/LyciaWeb/run/default/my_app
to
http://localhost:9090
add the following rule to the jetty-rewrite-rules.xml file:
<Configure id="Rewrite" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RedirectRegexRule">
<Set name="regex">^/$</Set>
<Set name="replacement">/LyciaWeb/run/default/my_app</Set>
</New>
</Arg>
</Call>
</Configure>