I have installed the DSpace backend and frontend, version 7.6.1.
They both run fine when I run the UI using "yarn start". When I enter in credentials to the 'Log In' area, I can log in and use the side admin panel fine. I can use Yarn and PM2 fine if I use their commands from the /opt/dspace-angular directory, which was where the UI was installed and built.
However, when I follow the Lyrasis instructions to create a 'dspace-ui-deploy' directory and copy dist and config/config.prod.yml to it, and create a basic dspace-ui.json in the folder, and then use PM2 there (pm2 start dspace-ui.json), the UI launches up fine and I can navigate, but I am unable to log in. I get the following errors in dspace.log:
2023-11-25 01:10:48,738 WARN unknown unknown org.dspace.app.rest.exception.DSpaceApiExceptionControllerAdvice @ Access is denied. Invalid CSRF token. (s
tatus:403 exception: Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-XSRF-TOKEN'. at: org.springframework.security.web.
csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:127))
2023-11-25 01:10:54,641 WARN unknown unknown org.dspace.app.rest.exception.DSpaceApiExceptionControllerAdvice @ Access is denied. Invalid CSRF token. (s
tatus:403 exception: Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-XSRF-TOKEN'. at: org.springframework.security.web.
csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:127))
My dspace-ui.json looks like this:
{
"apps": [
{
"name": "dspace-ui",
"cwd": "/opt/dspace-angular",
"script": "dist/server/main.js",
"instances": "max",
"exec_mode": "cluster",
"env": {
"NODE_ENV": "production"
}
}
]
}
And in local.cfg I do have this set:
rest.cors.allowed-origins = ${dspace.ui.url}, "http://<IP address>:4000", "http://localhost:4000", "http://127.0.0.1:4000"
Pertinent stuff from config.prod.yml:
ui:
ssl: false
host: myhostname.com
nameSpace: /
rateLimiter:
windowMs: 60000 # 1 minute
max: 500 # limit each IP to 500 requests per windowMs
# Trust X-FORWARDED-* headers from proxies (default = true)
useProxies: true
rest:
ssl: false
host: myhostname.com
nameSpace: /server
Any suggestions on why Yarn and PM2 work in the install/build folder but not the deploy folder, as per the installation instructions? What should I change?