Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8475129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:48:41+00:00 2026-06-10T17:48:41+00:00

I have an api from the backend, if I visit the url in browser

  • 0

I have an api from the backend, if I visit the url in browser directly, I can see the response correctly, but if I load it with Ajax, I always get a 502 Bad Gateway error.

The page and the api are in the same domain: http://xx.com and http://xx.com/api.

This is really weird, how could it happen?

Update: I explored it a little further and found that even var img = new Image(); img.src = url; get a 502 error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:48:43+00:00Added an answer on June 10, 2026 at 5:48 pm

    As this page helpfully explains, “the upstream server and the gateway/proxy do not agree on the protocol for exchanging data.” This could happen, in this case, because your Ajax request specifies different headers (such as a different “Accept” header), leading to a different entity type (i.e., body) being exchanged between your proxy and your actual back-end. I would advise using a tool like Firebug or the Chrome debugger to examine the details of your regular request and your Ajax request, look for significant differences, and add headers to your Ajax request as needed to get the desired result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django web front-end that consumes data from a REST API backend.
I have an API that returns a promise from a deferred object. The problem
Does the Ruby Mustache API have a way to return the key names from
I have just finished creating an API where the requests from the API are
I have a date I'm reading from an API in the following format: 2010-03-15T00:00:00-04:00
i have this code to get the search resutls from the api: querygoogle.php: <?php
I have the following json returned to me from an API. sections: { 1:
I have with an blue tooth application from android api sample.I am displaying blue
I have an iPhone application which basically is getting information from an API (in
I have a working SOAP request from my website to a .net based API.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.