Issue
So far, it's been possible to disable SPA across an instance, for some portlet or for an individual element. However, having more flexibility to disable SPA has been requested multiple times. What if I want to disable SPA for one site? Or just for one URL?
Environment
- Liferay DXP 7.3
Resolution
A new setting has been added to SPA configuration to help disabling SPA in different scenarios. If you access System settings > Infrastructure > Frontend SPA Infrastructure > Custom Excluded Paths you can add a new input field for every URL where you want to disable SPA.
In order to properly use this functionality there are a few considerations you might want to keep in mind:
- In every input field you must add only one path.
- If you add more than one path in one input field, those paths are not going to be excluded.
- If you leave empty one of the input fields, it would be matched as the root path and SPA would be completely disabled.
- That path must be just the pathname, leaving out the hostname.
- Ex: If you want to exclude the URL http://healthyfood:8080/web/food/vegetables, you just need to add the path /web/food/vegetables.
- Whatever is under the path you added is going to be excluded.
- Ex: If you want to exclude the whole site whose URL is http//healthyfood:8080/web/food, you just need to add the path /web/food and all the pages in that site would work without SPA.
- Every path is going to be excluded from SPA navigation independently of the hostname.
- Ex: You have following two URLs: http://healthyfood:8080/web/food/vegetables and http://beingafarmer:8080/web/food/vegetables and you exclude the path web/food/vegetables. You'll see that page is excluded from SPA navigation under both hostnames.
Finally, as it happens with any other system setting you can configure it through an OSGi configuration file. In this case you just need to add to your osgi/conf folder the file com.liferay.frontend.js.spa.web.configuration.SPAConfiguration.config with the content:
configuration:customExcludedPaths=[ \
"/web/food/vegetables", \
"/web/food/fruit", \
]
Additional Information
- This functionality has been added as part of LPS-128101.
- It is included in Liferay DXP 7.3 since fixpack-dxp-2-7310.