Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant send Cross Browser Requests #1907

Closed
BFunk86 opened this issue Dec 21, 2016 · 6 comments
Closed

Cant send Cross Browser Requests #1907

BFunk86 opened this issue Dec 21, 2016 · 6 comments

Comments

@BFunk86
Copy link

BFunk86 commented Dec 21, 2016

My Setup:

  • Dreamhost VPS
  • Apache2 version: 2.2.31-2
  • Passenger version: 4.0.59-1 / not sure if it is enterprise or community version
  • Nodejs version: 7.1.0
  • websites: programmingtheweb.com, youngbrandon.com

I am trying to make a cross browser XHR request while using passenger and it keeps failing. I have tried it on multiple sites. The first site, programmingtheweb.com is a Node application sending a POST request to Sendgrid upon contact form submit. I have tested this while running it on my computer and it works fine as well as running the app.js file from the terminal on port 3000 and when going to programmingtheweb.com:3000 the contact form works correctly and sends the email. When it is run using Phusion Passenger it doesn't work. The original code for this is on Github here: https://github.com/BFunk86/programmingtheweb.com

The second website that isn't working is youngbrandon.com. This issues a cross-browser GET request using javascript on the client side to call the http://api.icndb.com api when the user clicks the New Quote button.. This also works when not on Passenger and the code can be seen here: http://codepen.io/Youngbd/pen/NrRZam. The weird thing about this is that it makes the first GET request when the page loads, just not when the button is clicked.

So I guess my question is, is there something in Passenger that is blocking my request? I can not find anyone else experiencing this problem except one thread on stack overflow where the problem was due to an older version of Passenger. Any help would be greatly appreciated.

@BFunk86
Copy link
Author

BFunk86 commented Dec 21, 2016

Almost forgot. When I test the examples above the XHR request hangs and gives me a Provisional Header. This is the header:

General:
Request URL:http://programmingtheweb.com/api
Request Headers
Provisional headers are shown
Accept:/
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Origin:http://programmingtheweb.com
Referer:http://programmingtheweb.com/
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
X-Requested-With:XMLHttpRequest
Form Data
view source
view URL encoded
name:Brandon
email:brandon@test.com
comments:This is a test done at 12/20/2016 from Google Chrome @ 10:45

This is then followed by this when it finally finished about a minute later:

General:
Request URL:http://programmingtheweb.com/api
Request Method:POST
Status Code:500 Internal Server Error
Remote Address:64.111.121.148:80
Response Headers view source
Connection:close
Content-Encoding:gzip
Content-Length:403
Content-Type:text/html; charset=iso-8859-1
Date:Wed, 21 Dec 2016 03:45:28 GMT
Server:Apache
Status:500 Internal Server Error
Vary:Accept-Encoding
X-Pad:avoid browser bug
Request Headers
view source
Accept:/
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:116
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Cookie:_gat=1; _ga=GA1.2.153313091.1482291470
Host:programmingtheweb.com
Origin:http://programmingtheweb.com
Referer:http://programmingtheweb.com/
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
X-Requested-With:XMLHttpRequest
Form Data
view source
view URL encoded
name:Brandon
email:brandon@test.com
comments:This is a test done at 12/20/2016 from Google Chrome @ 10:45

@OnixGH
Copy link
Contributor

OnixGH commented Dec 21, 2016

Passenger doesn't have any blocking mechanisms, so I wouldn't guess the problem is there. The first place to look for potential issues is always the log, so please have a look there. You seem to have committed an apache_server.log to your GitHub project as well, which shows some issues.

Either way, please try this with the latest version of Passenger, as 4.0.59 is quite old.

@CamJN
Copy link
Contributor

CamJN commented Dec 21, 2016

You should also check if the correct CORS headers are set.

@BFunk86
Copy link
Author

BFunk86 commented Dec 22, 2016

@OnixGH That's an old log on Github, but the problem has since been fixed. There was a problem with the Sendgrid API key. I just don't understand why everything works until I use passenger. I can't access the server logs on my VPS since it's not allowed on Dreamhost. I have just finished creating a local development environment that mimics my Dreamhost VPS so I'll run some tests and see what's going on. Hopefully, I'll find something in the logs.

@OnixGH
Copy link
Contributor

OnixGH commented Jan 9, 2017

@BFunk86 any updates on this?

@OnixGH
Copy link
Contributor

OnixGH commented Jul 4, 2017

Closing due to inactivity + can't reproduce.

@OnixGH OnixGH closed this as completed Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants