For the ajax url shows 404 on the AWS tomcat log - javascript

I was using MVN install deploy my code on the AWS tomcat. I did this by directly open the AWSname:8080/manager/html and upload the WAR file(I am not sure if it is the correct way). The server can load the index.html successfully as my expectation and shows page on the front-end, but error went to call AJAX, which is in Javascript file, it always return 404. The servlet's url pattern will be like this
AJAX
Login Servlet
I tested everything fine on my localhost:8080, but in the AWS tomcat, the log showed like this.
Tomcat Log
I've never met such a case before, could somebody give me some useful suggestions on the possible solutions?

from your description it is not clear if you have multiple apps/war/containers/servers.
From your message you have a UI, which seems not to be bundled into your war file. To check in this case use these steps to check your setups
Add a index.html to your root in the war file and test if you can access it locally.
if this works, deploy on AWS and try to access the same path on AWS.
if the page is showing, your context is defined well on AWS. So you have an issue with your URL mappings
But if it does not show, you have a URL problem (wrong URL on AWS)

Related

Assets not fetched on cpanel server

I'm trying to work on cpanel before hosting my own website. And I'm very much new to this. After uploading my files on cpanel, I am getting the error and the assets folder is not read & my css & js files are not found. On localhost everything is working fine but on cpanel its not working.
I keep getting this error net::ERR_NAME_NOT_RESOLVED.
I tired looking for a solution, but most of them were regarding localhost, but the files are working on my localhost but not on cpanel.
Can anybody help me please.
Console errors:
Network JS headers:
I figured it out, the problem was the domain name, which direct the http request to the assets folder, but here I was using a free domain name that i got from infinityfree. And when i tried running the same link on a different cpanel with purchased domain name, it's loads up just fine.

Parcel server localhost:1234 does not work

I have Parcel installed to compile my javascript files. According the documentation I run parcel index.php commnad and tried to open localhost:1234 in the browser. No error in console only success message server is running on localhost:1234. But as I open the address I have 404 This localhost page can’t be found. What am I doing wrong?
Also if I try to use it like file watcher for index.js it works only for the first code update. Any other chages are not reflected in the result html..

Registering Serviceworker in Laravel

I'm using pushpad (from pushpad.xyz) and followed the 3 initial steps to setup this SDK with my Laravel 5.5 Project.
But as soon as I visit a test view it just cannot find and register the Serviceworker.js
i tried placing it all over the place, almost in every folder now. So i know this is vaguely described but if you take a quick look at the Docs from pushpad you know what I mean.
Moreover, when i manually try to open it i get a 404.
also getting 404 when i try to import it via from the https:// link where its located
when i copy its content and use it in a script tag i also get a 404.
im quite clueless as how to proceed
A bad HTTP response code (404) was received when fetching the script.
Failed to load resource: net::ERR_INVALID_RESPONSE
push-test:1 Uncaught (in promise) TypeError: Failed to register a
ServiceWorker: A bad HTTP response code (404) was received when fetching the
script.
You need to make sure that you have a service-worker.js file in the root directory of your website.
You can verify the installation by typing https://example.com/service-worker.js in your browser.

Azure Website 404 (Not Found) on PHP Resources

I'm new to all things coding and have tried to use Azure to host a web app. The app is JavaScript using PHP to process MYSQL data. Everything works locally as expected. But when I try to access the app where it's hosted, I see 404 (Not Found) errors on all of my calls to .php files.
I'm using jQuery's getJSON to get data:
$.getJSON('bin/myFile.php', function(data) {
// Process data
})
Then in the browser console I see:
GET https://mysite.azurewebsites.net/bin/myFile.php 404 (Not Found)
But, if I move that file to the root directory and drop the bin/ from my call, it works perfectly. All other calls to files in folders work fine (images, scripts, styles), only the php files in the bin folder return this error.
Anyone know why?
Answer from comments:
Try renaming your bin folder. That is normally where binary files are placed in a windows web app environment, so it's possible the Azure server is configured to not serve any files from that location –
Rory McCrossan
Sep 26 '17 at 16:22

Run Meteor from within a folder

I've run meteor build to create my bundle, uploaded to the server, it runs fine, however the .css and .js paths are wrong, as it's using the root url. I need to run this from within a /project folder. Again it's running, but 404 on the files as they're not prefixed with /project.
eg. http://domain.com/65d054cb90ff094804072528d222178ddbf625e22.js?meteor_js_resource=true 404 (Not Found)
needs to be http://domain.com/project/65d054cb90ff094804072528d222178ddbf625e22.js?meteor_js_resource=true
I've tried using ROOT_URL=http://domain.com/project node main.js, that gives an unknown path error, i've also tried using Meteor.absoluteUrl('project', {}); in conjuntion with rooturl but again, no avail.
Any of you fine people have any ideas? :) Thanks!
PS. It's running on an apache server with ProxyPass, if that's of relevance.
You could instruct your apache to redirect those calls with a ProxyPassMatch, such as:
<LocationMatch ^/(.*)meteor_js_resource=true$>
ProxyPassMatch http://localhost/project/$1meteor_js_resource=true
</LocationMatch>

Categories