Run Meteor from within a folder - javascript

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>

Related

For the ajax url shows 404 on the AWS tomcat log

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)

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

Tomcat 404 error, image js and css are not found

I used tomcat 7 for deploy my war file. It contains various images, css and js file.
I configure my tomcat on port 8080. Everything goes fine but I don't know why these content not serve by tomcat. It gives 404 not found error.
Directory Structure
And I hit this below url
http://localhost:8080/images/jackson2.png
When I put these images outside ROOT folder to inside webapps/examples/ then it works fine.
Now what is wrong with it ? It there anything I missed ?
I could not understand the issue ? Help me
Perhaps check that tomcat and/or the image files have the correct permissions set, I'm not too sure how to go about it on windows, depending on which version your running it could be a UAC issue, you can try looking here: https://www.mulesoft.com/tcat/tomcat-windows. You can try stopping tomcat, remove the work and temp directories, then starting tomcat.

Socket.IO accepts non-existing src tag?

I'm doing some 'Get started thing' on Socket.IO and I noticed there was a step where I had to add the socket.io.js script to the HTML page. It said the following:
/socket.io/socket.io.js
In in my folders however, socket.io.js is at the following path:
/node_modules/socket.io/node_modules/socket.io-client/socket.io.js
There location socket.io doesn't exist in the root of the directory. Why exactly is it then that the first path works but the second doesn't?
The server-side socket.io code installs a nodejs route handler for /socket.io/socket.io.js so that it can serve the socket.io.js file from its real location when /socket.io/socket.io.js is requested by a browser.
Remember, nodejs does not serve any local files automatically. It only serves files that are processed by some sort of route or handler. There is no route for node_modules/socket.io/node_modules/socket.io-client/socket.io.js so if a browser requests that, it won't serve anything.

Heroku(Cedar) + Node + Express + Jade Client-side javascript files in subdirectory work locally with foreman+curl but not when pushed to Heroku

I am very new to node and heroku and I suspect this is some kind of simple permission issue etc, but I can't seem to track it down.
I have several pure javascript files in a sub-directory one level beneath my root directory where my web.js file is sitting. I have a line in my web.js file to specify the directory
app.use('/heatcanvas',express.static(__dirname+'/heatcanvas'));
If I run my app locally with Heroku Foreman I get the expected js response when I run the following curl command
curl localhost:5000/heatcanvas/heatcanvas.js
However when I push to Heroku and hit the corresponsing live url in the browser
www.example.com/heatcanvas/heatcanvas.js
I receive the following:
Cannot GET /heatcanvas/heatcanvas.js
If I check Firebug and/or the Heroku logs I see I am actually getting 404 errors for those files even though the pathing should match what is being done locally. It is also worth mentioning that third party javascript is coming over just fine, it is only when the src attribute of the script tag points to my site that there is an issue. What do I need to do to get my scripts to be available?
I recommend you to use process.cwd() value to get specific directory
process.env.PWD = process.cwd()
at the very beginning of your web.js
let you access files easily.
You can do
app.use('/heatcanvas',express.static(process.env.PWD+'/heatcanvas'));
instead of using
__dirname
Warning: Make sure to execute web.js at the root directory of web.js (Heroku web.js are executed that way)

Categories