cancel
Showing results for 
Search instead for 
Did you mean: 

Nginx Error for local UI5 application development

cristiano_santos
Participant
0 Kudos

Hi! I am following this blog to setup local develpment environment.

https://blogs.sap.com/2020/05/07/developing-ui5-application-locally-using-nginx-http-reverse-proxy-s...

The root location is workng fine for the webapp folder, but not for resources folder . What I am doing wrong? I am doing the same steps from blog above. See the attached screenshots.

Regards.

Nginx configuration

localhost root destination

destination for resources not ok

GregMalewski
Contributor
0 Kudos

Location "resources" is for serving UI5 library files. It will not present any web content.

cristiano_santos
Participant

Thanks grzegorz.malewski . I had not given good examples. So I have updated the question description with correct screenshots.

Accepted Solutions (0)

Answers (2)

Answers (2)

thalesvb
Active Contributor
0 Kudos

Hello Cristiano, you can't forget that you are also using Nginx, you could check its log too to diagnose and try to trace the issue.

This case the error is pointed there, you should be having some "[error] 21#21: *1 open() "C:\Users\...\sapui5\resources\resources\sap-ui-core.js" failed (2: No such file or directory)" lines popping on log (also something similar to sandbox.js file). This is because root directive receives a base path and concatenates all path on URL to build local file path, this. .Nginx is trying to read file in paths

c:\Users\...\sapui5\resources\resources\sap-ui-core.js
c:\Users\...\sapui5\resources\test-resources\sap\ushell\bootstrap\sandbox.js

when the correct path are:

c:\Users\...\sapui5\resources\sap-ui-core.js
c:\Users\...\sapui5\test-resources\sap\ushell\bootstrap\sandbox.js

This is a bit misleading behavior in Nginx if you never stopped to read root directive on Nginx documentation.

Your Javascript snippet have incorrect paths, you should strip out the first "resources" directory. This will fix it loading sap-ui-core.js file (your network print state this), but that blog is about UI5 only and you are also using UShell (Fiori), which resides on "test-resources" folder, so you also need to add "/test-resources/" location to your configuration. root directive will be the same from "/resources/" location, because the root (base) path is the same:

location /test-resources/ {
  root C:\Users\crist\git-root\sapui5;
  autoindex on;
}

And your javascript resources paths (from that snippet) will be:

"test-resources/sap/ushell/bootstrap/sandbox.js"
"resources/sap-ui-core.js"

Best regards

GregMalewski
Contributor
0 Kudos

Hi Cristiano, Looks like you need to put your UI5 lib files in appInventario folder or move your webapp folder to git-root and adjust the location parmeters accordingly. Regards Greg