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

API response header "Content-Type" should be application/json instead of text/html that fails AWS ALB #3134

Closed
3 tasks done
shawnzhu opened this issue Jul 15, 2017 · 1 comment · Fixed by #3135
Closed
3 tasks done

Comments

@shawnzhu
Copy link
Contributor

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • I have checked the issue tracker for the same issue and I haven't found one similar

Superset version

0.18.4

Expected results

Request:

Request URL:http://localhost:8088/superset/testconn
Request Method:POST
Status Code:200 OK
Remote Address:[::1]:8088
Referrer Policy:no-referrer-when-downgrade

Response header:

Connection:close
Content-Length:292
Content-Type:application/json; charset=utf-8
Date:Sat, 15 Jul 2017 03:05:32 GMT
Server:gunicorn/19.7.1

Actual results

Request:

Request URL:http://localhost:8088/superset/testconn
Request Method:POST
Status Code:200 OK
Remote Address:[::1]:8088
Referrer Policy:no-referrer-when-downgrade

Response headers (Content-Type should be application/json instead of text/html since the message body is JSON):

Connection:close
Content-Length:292
Content-Type:text/html; charset=utf-8
Date:Sat, 15 Jul 2017 03:05:32 GMT
Server:gunicorn/19.7.1

When deploying to AWS with an application load balancer (ALB), you will get response code 502:

Response headers:

content-length:540
content-type:text/html
date:Sat, 15 Jul 2017 02:59:59 GMT
server:awselb/2.0
status:502

Response body:

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->

I suspect it is the response content type confuses ALB which results in status code 502.

Steps to reproduce

Navigate Chrome v59.0.3071.115 to Sources -> Databases -> Add new database -> click button Test Connection. Then you will see the above actual results from network panel of developer tools.

@shawnzhu shawnzhu changed the title API response header "Content-Type" should be application/json instead of text/html API response header "Content-Type" should be application/json instead of text/html fails AWS ALB Jul 15, 2017
@shawnzhu shawnzhu changed the title API response header "Content-Type" should be application/json instead of text/html fails AWS ALB API response header "Content-Type" should be application/json instead of text/html that fails AWS ALB Jul 15, 2017
@shawnzhu
Copy link
Contributor Author

See troubleshooting guide I get HTTP 502 errors when I make requests through a load balancer. How do I troubleshoot these errors?:

HTTP 502 (Bad Gateways) errors can occur if either the web server or associated back-end application servers running on EC2 instances return an error message that cannot be parsed by Elastic Load Balancing (ELB).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant