DSpace UI on different server can not communicate with backend

211 views
Skip to first unread message

Christoforos Korifidis

unread,
Apr 23, 2023, 7:33:36 AM4/23/23
to DSpace Community
Hello,

I have set up my dsapce ui with ngins as proxy and backend on differnet server.
My config.prod.ymll is:
ui:
        ssl: false
        host: 127.0.0.1
        port: 4000
        nameSpace: /

rest:
        ssl: false
        host: dspace.tatoi.mnss.eu
        port: 80
        nameSpace: /server

My nginx configuration is:
server {
        listen 80;
        server_name tatoi-ui.mnss.eu;
        location / {
                include proxy_params;
                proxy_pass http://127.0.0.1:4000;
        }
}

Unfortunately my UI si  not working. I see a 500 error on the screen.
In the nginx access.log I see the following record:

 [23/Apr/2023:14:28:36 +0300] "GET / HTTP/1.1" 500 58026 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0"

I see no error record on nginx's error.log neither on the error log , or out log of pm2 that runs the angular process.

Is there any place else to look for error logs?
I am stuck in this. Any help is appreciated.


                 

Christoforos Korifidis

unread,
Apr 23, 2023, 2:55:15 PM4/23/23
to DSpace Community
An upddate:
I have chnaged the way I start the UI server and instead of pm2 I use node like this:

node ./dist/server/main.js

And by starting I get the following messages:

Unable to find default config file at /var/www/tatoireposfe-deploy/config/config.yaml
Unable to find env config file at /var/www/tatoireposfe-deploy/config/config.production.yaml
Angular config.json file generated correctly at /var/www/tatoireposfe-deploy/dist/browser/assets/config.json

I have copied from the source directory config.yml in both
/var/www/tatoireposfe-deploy/config/config.yaml
and
/var/www/tatoireposfe-deploy/config/config.yml

The contents of this two file is:
rest:
  ssl: false
  host: localhost
  port: 4000
  nameSpace: /server

Nevertheless when node application start does not recognize them.

I see by the end of start up this outpout:

[HPM] Proxy created: /  -> http://localhost:8080//sitemaps

I don;t know exactly what this means but when I try to access the ui
I see the following output from the node:

Error:  HttpErrorResponse {
  headers: HttpHeaders {
    normalizedNames: Map(0) {},
    lazyUpdate: null,
    headers: Map(0) {}
  },
  status: 0,
  statusText: 'Unknown Error',
  url: 'http://localhost:8080/api',
  ok: false,
  name: 'HttpErrorResponse',
  message: 'Http failure response for http://localhost:8080/api: 0 Unknown Error',
  error: ProgressEvent {
    type: 'error',
    target: XMLHttpRequest {
      onloadstart: null,
      onprogress: null,
      onabort: null,
      onerror: null,
      onload: null,
      ontimeout: null,
      onloadend: null,
      _listeners: [Object],
      onreadystatechange: null,
      _anonymous: undefined,
      readyState: 4,
      response: null,
      responseText: '',
      responseType: 'text',
      responseURL: '',
      status: 0,
      statusText: '',
      timeout: 0,
      upload: [XMLHttpRequestUpload],
      _method: 'GET',
      _url: [Url],
      _sync: false,
      _headers: [Object],
      _loweredHeaders: [Object],
      _mimeOverride: null,
      _request: null,
      _response: null,
      _responseParts: null,
      _responseHeaders: null,
      _aborting: null,
      _error: null,
      _loadedBytes: 0,
      _totalBytes: 0,
      _lengthComputable: false,
      nodejsHttpAgent: [Agent],
      nodejsHttpsAgent: [Agent],
      withCredentials: true
    },
    currentTarget: XMLHttpRequest {
      onloadstart: null,
      onprogress: null,
      onabort: null,
      onerror: null,
      onload: null,
      ontimeout: null,
      onloadend: null,
      _listeners: [Object],
      onreadystatechange: null,
      _anonymous: undefined,
      readyState: 4,
      response: null,
      responseText: '',
      responseType: 'text',
      responseURL: '',
      status: 0,
      statusText: '',
      timeout: 0,
      upload: [XMLHttpRequestUpload],
      _method: 'GET',
      _url: [Url],
      _sync: false,
      _headers: [Object],
      _loweredHeaders: [Object],
      _mimeOverride: null,
      _request: null,
      _response: null,
      _responseParts: null,
      _responseHeaders: null,
      _aborting: null,
      _error: null,
      _loadedBytes: 0,
      _totalBytes: 0,
      _lengthComputable: false,
      nodejsHttpAgent: [Agent],
      nodejsHttpsAgent: [Agent],
      withCredentials: true
    },
    lengthComputable: false,
    loaded: 0,
    total: 0
  }
}
{
  statusCode: 0,
  statusText: 'Unknown Error',
  message: 'Http failure response for http://localhost:8080/api: 0 Unknown Error'
}


If I understand correct it tries to access dspace backend thorugh the url (higligted with yellow) on the above output:
That's wrong url. The correct url is  dspace.tatoi.mnss.eu
and it is defined in dist/config/config.prod.yml.
Content of config.prog.yml is:

ui:
        ssl: false
        host: 127.0.0.1
        port: 4000
        nameSpace: /

rest:
        ssl: false
        host: dspace.tatoi.mnss.eu
        port: 80
        nameSpace: /server




I don't know why UI is not reading the correct setup from  cofnig.prod.yml and I think this is the main problem.

any help is appreciated.
Reply all
Reply to author
Forward
0 new messages