Allow serving catalog from a path relative to server root #478
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This aims to address #443
This change across several files allows to serve a catalog e.g. from
http://localhost:8000/subdir/mycatalog
with themycatalog
directory containing all necessary components of the catalog, such as assets, metadata, etc. The changes involved:<base>
html tag in theindex.html
file and assigning its href property dynamically based onwindow.location.path
/
) to relative paths, that will now be interpreted as relative to the<base>
taghref
propertybase
property to also be assigned dynamically fromwindow.location.path
catalog-serve
command andWebcatalog.serve()
method to accept an optionalbase
argument which allows a local server to serve the base path as root, and then use the relative portion of the catalog location relative to the base path in order to set the correct redirect configuration. Previously, the redirect rule from/dataset
to/index.html
basically assumed that the base path and catalog location were the same. Now the redirect rule uses the relative portion to redirect from/{relpath}/dataset
to/{relpath}/index.html
.The last point implies that any server using a catalog location that is different from and relative to the base path will have to change their redirect rules to accommodate the relative portion.
Lastly, some metadata that was found to be faulty during testing was updated.