Hi all
I am using Cuba framework to develop application: My application contains core,global,web and front module using react. I have a problem when I deploy war file to tomcat server. If I build uberjar, I can access both web module and front module. But I can not access front module if I build war file and deploy to tomcat server.
Do you know what I need to do or notice when I deploy whole applicaiton contains front module to tomcat server?
For example: If I run local, I can access localhost:8080/myApp and localhost:8080/myApp-front. When I deploy war file to tomcat server, I only can access host/myApp and not possible for host/myApp-front. I saw in tomcat servermanager, it contains only application myApp in the list of application, I guess it could be a reason.
Many thanks in advance
Hi,
Creating a single WAR file
If the application project contains the front module, it becomes accessible at/<appName>/front
path. In order for the frontend interface to work correctly in the single WAR, you should change the environment variablePUBLIC_URL= /app/front/
during build (for example, in the.env.production.local
It’s mentioned here: buildWar - CUBA Platform. Developer’s Manual
It works so because when you are deploying one WAR file (“app.war”) then context path of any content inside of this WAR becomes starting with “/app/”.
My .env.production.local file contain this and working fine on localhost
PUBLIC_URL=/app-front/
REACT_APP_CUBA_URL=/app/rest/
but rest front app can’t be reached by any of this
baseURL/app/rest or baseURL/front or baseURL/app-front.
csurvey shows blank page? and developer windows shows this error
Please advice.
index.flt file have all references to /app-front/ whereas server has app on root/front location. I checked by changing all permutation of public_URL from /front/ to /aap/front/ but index.flt file is same.
If I change all /app-front/ from flt file to /from/ app runs but gives error on login.
PS - After deleting built directory and uploading app again it is showing login page but on login it is showing error ’ unknown error"
On login i am getting following unknown error. developer tools show this -
2.23030a92.chunk.js:2 CubaRestError: Unexpected token < in JSON at position 0
at new t (2.23030a92.chunk.js:2:852813)
at h (2.23030a92.chunk.js:2:515819)
Its working now after changing to this - REACT_APP_CUBA_URL=/rest/