Cross-Origin Failure with Express Node Server - firefox

My code works perfectly on localhost but when I get it uploaded to my Debian VPS server it will not fire. However a cURL -H -origin request works perfectly... I've tried everything PLEASE HELP!! lol
Here is my Firefox-Firebug error:::
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:10005/threadpreview. (Reason: CORS request failed).
This is really a HUGE problem for me. I've tried just about EVERY Access-Control-Allow-Headers/Methods/Origin combination possible. Truly at a loss. I've also tried all the preflight requests. It shouldn't need one but I've still tried to no avail.
Could it be server security? I am working off of a VPS Debian Squeeze server.... Their firewall maybe?
This is my portfolio I need to get online so I can get myself employed.... sigh! Please help and thanks!!

When you are accessing your webpage on a remote server you can't use local host.
You want to make the request against your vps IP address. Or domain name if you have it.
Calling local host on a browser client is going to request resources from the client computer as opposed to your server

Related

I can access my heroku free subdomain site via a browser, but I can't ping to it in the terminal

I have this site at heroku that I am trying to ping. It says
Ping request could not find host https://doc-hero.herokuapp.com/. Please check the name and try again.
even though I can still open the site on a browser. I thought it was an issue with heroku so I hosted it again on pythonanywhere but it still won't ping.
I'm sure there is a simple explanation for this but I tried Google and still no luck.
Is there a way I can get it to ping?
You might be wondering why I want it to do that when I can still browse to it. Well, it's because I need it to be visible to Open AI so that it can access some documents over there.
remove https:// prefix. ping is a different protocol and requires DNS only not protocol prefix.
heroku server still will probably not answer ping request as it is not required to.

How to resolve cloudflare not displaying my website on my phone

I keep having this error when I try to access my website that is hosted on aws and using cloudflare CDN.
But the surprising thing is that it is loading correctly on another person's phone.
What can be the issue and how can I resolve it?
Cloudflare error
This error specified a connection error between Cloudflare and your Origin server.
There are a couple ways this could be occurring on your device but not another's -
If you recently added Cloudflare, the DNS may still be resolving to your Origin server (for the person who it is working for). You can check this by doing a ping on their device to your domain, and seeing if it resolves to your Origin IP. Or you can check the response headers for any with CF- prefix (which means it is likely routing through Cloudflare).
Another possibility is that your Origin server is blocking some Cloudflare servers but not others. For instance when you request the site, it may be routing through Cloudflare 'Server A', while when the other person requests your site, it is routing through 'Server B'. If 'Server A' requests are failing / being blocked, this would explain the behavior you are seeing. You can check your Origin server's access logs to see if this is occurring. If it is a blocking situation, you'll want to ensure all Cloudflare's IP are whitelisted - https://www.cloudflare.com/ips/
More troubleshooting information from the Cloudflare forums - https://community.cloudflare.com/t/community-tip-fixing-error-522-connection-timed-out/42325

How can I access a maven repository from a vultr server?

My cloud server on vultr seems to be blocked by Maven so I cannot install some software.
For example,
wget https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy/1.4.20/byte-buddy-1.4.20.pom
results in HTTP request sent, awaiting response... 403 Forbidden. However, I can run this fine on my local computer, so it seems that my cloud server's IP is blocked. Is there any good solution to get around this?
The server is using IPV6
I have the same problem with you when using VPS in Tokyo. So I opened a ticket in vultr, but the supporter said "This is something which is being blocked on the repository's end, not on our end. We have no control over it." I recommend switching to a VPS in Los Angeles, that is working for me

No 'Access-Control-Allow-Origin' issue, despite all resources being on same domain

I am writing a javascript/strophejs xmpp client, and have been so far using it to connect to a xmpp server hosted at hosted.im, via a public BOSH service (http://bosh.metajack.im:5280/xmpp-httpbind). The html/javascript is also hosted online, at testserver.host56.com (not the real url).
Now, I decided to host the xmpp server on the amazon web cloud, and use my own Bosh service, hosted on this server as well.
Now, my ec2 instance is at myAWSDNS.us-west-2.compute.amazonaws.com (also not real url).
I also have a BOSH service up and running, at myAWSDNS.us-west-2.compute.amazonaws.com:7070.
Finally, I have also allowed traffic to this ec2 instance through both the instances firewall and through the AWS Security Group policy.
However, when trying to connect to this instance's xmpp server (openfire), using my JS/strophejs client, I get the following message in the Chrome javascript console:
XMLHttpRequest cannot load http://myAWSDNS.us-west-2.compute.amazonaws.com:7070/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://myAWSDNS.us-west-2.compute.amazonaws.com' is therefore not allowed access
Why am I getting this issue, if the origin is on the same domain as the requested resource?
The Ec2 instance is running Windows Server 2012.
This is the code I use to log in:
var conn = new Strophe.Connection("http://myAWSDNS.us-west-2.compute.amazonaws.com:7070/");
conn.connect("chris#myAWSDNS.us-west-2.compute.amazonaws.com", "myPassword", somecallback);
Thanks,
best regards,
Chris
As previously mentioned, even if you're on the same domain, the ports must also match otherwise CORS is required.
You may not be using the correct URL for your connection manager, all of the ones I've seen use an address ending in /http-bind/ or similar.
Have you tried connecting with Strophe.Connection("http://myAWSDNS.us-west-2.compute.amazonaws.com:7070/http-bind/");?
Also, you can test for the presence of the crossdomain.xml file by simply visiting http://myAWSDNS.us-west-2.compute.amazonaws.com:7070/crossdomain.xml to ensure that CORS has been successfully enabled.
The browser will not allow since the ports are different. I don't know what you have at AWS, but you can proxy the request in both direction, like as:
http://myAWSDNS.us-west-2.compute.amazonaws.com/http-bind/ <---------> http://myAWSDNS.us-west-2.compute.amazonaws.com:7070/
See item no 5: Connecting with Strophe.js of the tutorial for Apache use case.

Heroku error 503, webSockets on multiple domains

I'm experiencing a 503 error with heroku on my project using WebSockets and a custom domain.
Connecting on http://www.mydomain.com (That point with CNAME on my heroku app)
WebSocket connection to 'ws://www.mydomain.com/shoutbox' failed: Error during WebSocket handshake: Unexpected response code: 503
Connecting on http://myapp.herokuapp.com
Everything goes allright with adress ws://myapp.herokuapp.com/shoutbox. Everything is also good in my local setup.
Is there any cross-domain issue I'm not aware off ? I'm using play!2 as server side fwk, but I don't think there is any relation to this problem.
[EDIT]
If I can only connect within my own domain then it would be fine. Cause this would be the address I'd like people to use.
I'm assuming you already enabled heroku labs:enable websockets since your herokuapp domain is working properly.
I have a hunch your DNS query is hitting a Heroku endpoint that doesn't support websockets, i.e. it's cached from before you enabled the websockets functionality.
If this behavior only happens on a single client, try flushing your DNS cache and trying again. Alternatively, make sure the DNS records for both of your domains are resolving to the same IP.

Resources