Deploy Ionic 4 App to Apache sever - ionic-framework

I'm trying to deploy the new Ionic 4 app to an Apache server. I have ran.
ionic serve
to make sure it builds locally
Then I ran
ionic build
Then ran
ionic build --prod
This was to produce the production files in www.
But when I upload the files to the server and go to the index.html file it shows nothing. I keep getting errors in the console.
Failed to load resource: the server responded with a status of 404
(Not Found) runtime.js
Failed to load resource: the server responded with a status of 404
(Not Found) polyfills.js
and four other errors.
Any help would be great.

You have to define the "baseHref" so that you get the files correctly.
Surely you have a directory is your app.
For example. http://yourdomain.com/ionicApp
In this case you would have to define in the index.html file:

Related

ionic app not able to refresh due to /home routing

Built a fresh ionic v5 app from blank template. Added minimal logic to the home page for a simple toy project and deployed to a static blob on Azure.
Copied www folder to a blob and then made it public. Surf to the URL of index.html but this produced many errors of runtime.js:1 Failed to load resource: the server responded with a status of 400 (One of the request inputs is out of range.)
So then I tried a fresh storage module and used the 'static website` option and that does work except...
when it runs, it adds /home to the address and if the user tries to refresh the page then it fails with The requested content does not exist. because of course it thinks that's a resource inside the site.
You can simulate this by running a server (eg. http-server) inside the www folder, run the app then refresh with F5. I notice there is no problem when running using the dev command ng serve
Older ionic projects didn't have this problem. Have I done something peculiar?
This prevents any mobile phone from viewing the app and then adding to home screen because it includes the /home in the address.
Have found a partial solution here
https://stackoverflow.com/a/56584151/769427
which describes using the 404 page setting of a static website to point at index.html.
It does make it work (and with deep linking too) but the disadvantage is that a 404 error is registered each time in the dev tools.

Apache Tomcat server failed to run in localhost

I downloaded the tomcat version 9 in zip folder and added to eclipse. I am trying to run tomcat server version 9 in localhost . The server is able to run in eclipse but when I tried to access it in localhost , its showing following errors .
HTTP Status 404 – Not Found
Type Status Report
Message /
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
Apache Tomcat/9.0.24
Here is screen shot in IDE that serve is running ..
Here is screen shot when I tried to access it http://localhost:8000/

Unable to deploy SAPUI5 application with 404 error

I have created an app through the SAP Web IDE Full-Stack and attempted to deploy it to the SAP Cloud Platform. This appears to work fine, however, when I then go to use the deployed link it just displays "HTTP Status 404 - Not Found".
I tried looking for other solutions but had no luck. Here is my neo-app.json file:
And this is my apps structure:
So it appears that it is pointing to the index correctly, the only thing I am noticing is that in the generated dist it does not contain an index file. I have tried manually adding it but it is being removed upon project rebuilt.
Could this be the problem? If so how can I fix this?
Any help would be greatly appreciated
The folder structure of your SAP UI5 app is very important during deployment. Ideally you should have your webapp folder and your dist folder as the only folders in the root directory of the app. (It's okay if you do not have a dist folder).
Your neo-app.json file should also have a line like "welcomeFile":"webapp/index.html", pointing to your index.html or the root file of your application.
This should mostly solve the HTTP Status 404 issues.
Managed to fix the issue, not entirely sure why, but upon removing the ExternalLib folder i can now successfully deploy and run the app on the SAP cloud platform

How to test SAPUI5 apps locally in apache tomacat installed in eclipse?

I am working on SAPUI5 app which was created long back and running successfully. Now I need to do some enhancements and for that I downloaded the app and uploaded in eclipse.
Now when I am running this app locally - It is not working as the XMLHTTP Request says 404 (Not Found) when accessing the backend OData service.
URI is : /sap/opu/odata/sap/Z****SRV";
I understand that I need to add http://<host>:<port> before URI.
But I cannot change it in all the places. I found out that we can write <param-value> in web.xml file but I did and still it is not working
Can someone guide me how?

Failed to load resource: the server responded with a status of 404 (Not Found)

I'm using worklight studio within eclipse. I created a new workspace and created a new worklight project without changing anything in the basic project.
When I run the app in the preview mode in Chrome i can see this error in the console:
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:10080/appTest/apps/services/preview/appTest/common/1.0/default/worklight/messages/it-/messages.json
wlclient init started
before: initOptions.onSuccess
after: initOptions.onSuccess
wlclient init success
How do i solve it?
thanks!
Try this:
In Eclipse, go to Help > Check for updates
This should update Worklight Studio to a build from August 1st 2014, containing several fixes including one related to previewing applications.
PI21516 APPLICATION PREVIEW PROVIDING INCORRECT HTML AFTER SUCCESSIVE REFRESHES
PI22595 WHEN SWITCHING WORKLIGHT VERSIONS FREQUENTLY, A DEVELOPER COULD INTERMITTENTLY SEE WLJQ.JS DROPPED DURING PREVIEW.
Use a fresh workspace
BTW, do let me know if there is anything language-specific in your application or Chrome installation... the error message is strange, but does mention it-/messages.json... not sure where it is coming from, but it may be due to some language related issue, so, let me know.