Overview
This configuration setting allows you to specify an additional URL for the DSpace backend, which can be utilized by the DSpace frontend during Server-Side Rendering (SSR) execution. This is particularly useful for ensuring that the frontend can communicate with the backend during SSR processes by using a private REST server address, ensuring secure and efficient backend interactions during SSR.
Configuration
REST Configuration
In your local.cfg add the new dspace.server.ssr.url which specifies the URL of the DSpace backend to be used during SSR execution by the DSpace frontend.
# Additional URL of DSpace backend which could be used by DSpace frontend during SSR execution. # May require a port number if not using standard ports (80 or 443) # DO NOT end it with '/'. dspace.server.ssr.url =
Notes
The URL may require a port number if it is not using the standard ports (80 for HTTP or 443 for HTTPS).
The URL should not end with a ‘/’.
Example Configuration
# Example with a port number dspace.server.ssr.url=http://private-backend.example.com:8080/server # Example without a port number (assuming standard ports) dspace.server.ssr.url=https://private-backend.example.com/server
Frontend Configuration
In addition to the backend configuration, the frontend environment also requires specific settings to define which REST API server to use during SSR. These settings are synced with the dspace.server.ssr.url setting in your backend’s local.cfg.
In the rest section of your your config.prod.yml add the new ssrBaseUrl property
# The REST API server settings # NOTE: these settings define which (publicly available) REST API to use. They are usually # 'synced' with the 'dspace.server.url' setting in your backend's local.cfg. rest: ssl: true host: dspacecris7.4science.cloud port: 443 # NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript nameSpace: /server # NOTE: Additional URL of DSpace backend which could be used by DSpace frontend during SSR execution. ssrBaseUrl: https://localhost:8080/server
Notes
Ensure that the URL is accessible from the environment where the SSR execution takes place.
Double-check that the URL does not end with a ‘/’ to avoid potential issues with URL resolution.
Example Configuration
# Example with a port number rest: ssl: true host: dspacecris7.4science.cloud port: 443 nameSpace: /server ssrBaseUrl: http://private-backend.example.com:8080/server # Example without a port number (assuming standard ports) rest: ssl: true host: dspacecris7.4science.cloud port: 443 nameSpace: /server ssrBaseUrl: https://private-backend.example.com/server
Troubleshooting
Issue: SSR execution fails to connect to the backend.
Solution: Verify that the URL is correctly configured and accessible. Check for network issues or firewall settings that might be blocking the connection.
Issue: Unexpected behavior during SSR.
Solution: Ensure that the URL does not end with a ‘/’ and that the correct port number is specified if not using standard ports.