Giter Club home page Giter Club logo

Comments (16)

githubsaturn avatar githubsaturn commented on May 15, 2024 4

If you can reproduce the issue with an open source project I can look into it.

My "guess" is that you need to change your binding to 0.0.0.0

Regarding the HTTP auth, I believe it's a CloudFlare issue. They intercept the http request and manage the Basic Auth for you. You can disable the interception on CloudFlare interface by clicking on the orange cloud to turn it into a grey cloud.

from caprover.

prabirshrestha avatar prabirshrestha commented on May 15, 2024 2

@githubsaturn Seems like this needs to be document in FAQ. https://caprover.com/docs/troubleshooting.html#successful-deploy-but-502-bad-gateway-error

I spent an hour debugging this 502 error and using 0.0.0.0 seems to work.

from caprover.

githubsaturn avatar githubsaturn commented on May 15, 2024

The case you described works fine with Captain. Personally, I have multiple apps like that and they are all running fine.

So you're saying your static files (front end) loads fine but backend POST request results in 502? This should not be possible.

This seems to be your app bug,not Captain. You probably are not usi relative paths for your requests. Please provide a test app for further investigation. Alternatively, please include your webapp address so i can look into it.

from caprover.

Derwaan avatar Derwaan commented on May 15, 2024

Here are the simple code when user is authenticate.

The client side using Angular2:

  authenticateUser(user) {
    let headers = new Headers();
    headers.append('Content-Type', 'application/json')

    return this.http.post('api/login', user, {
      headers: headers
    }).map(res => res.json())
  }

And for the server side (straightforward):

router.post('/api/login', authController.authenticate)

It must be the URI used in the client side api/login that cause the error.

from caprover.

githubsaturn avatar githubsaturn commented on May 15, 2024

This is not a CaptainDuckDuck related question. This is specific to your app. CaptainDuckDuck forwards all requests to app.com to your app without interfering with them.

To reopen, if you have a repro case, please upload a tarball file of your application that exhibits the problem.

from caprover.

opensourcekam avatar opensourcekam commented on May 15, 2024

This is happening on one of my captain apps and not the rest but here's the catch every third request is throwing a 502 error. I'm not sure what the root cause is because locally I can run my request at about 100 request /s but once deployed to my captain server It seems to fail every third request. I'm still investigating and this is the closing sounding to my case.

from caprover.

buglinjo avatar buglinjo commented on May 15, 2024

Have the same issue with AdonisJS deployment. It is running on 127.0.0.1:3333 I changed container http port to 3333 but still the same 502 error. I tried port mapping and still the same. I'm trying to fix this all freaking day lol, but nothing.

from caprover.

githubsaturn avatar githubsaturn commented on May 15, 2024

Are you sure that your app is actually running? 502 means that nginx cannot connect to your app. Wrong binding port is one of the potential problems. To resolve:

  • First change container http port to 3333 (like you did)
  • Next, verify that your application is actually running. Go to the deploy tab of your app and view the logs. Your app might be erroring and restarting or not starting up properly.

from caprover.

buglinjo avatar buglinjo commented on May 15, 2024

That's what it sais in application logs.

from caprover.

githubsaturn avatar githubsaturn commented on May 15, 2024

That's what it sais in application logs.

Are you saying in your application log you see 502 error? Can you please copy and paste your application logs here?

from caprover.

buglinjo avatar buglinjo commented on May 15, 2024

This is my application log:

2019-04-08T22:44:26.890354034Z 
2019-04-08T22:44:26.890394993Z > [email protected] start /usr/src/app
2019-04-08T22:44:26.890401146Z > node server.js
2019-04-08T22:44:26.890405113Z 
2019-04-08T22:44:27.265140778Z info: serving app on http://127.0.0.1:3333

from caprover.

buglinjo avatar buglinjo commented on May 15, 2024

One more thing, I tried adding HTTP Basic Auth and it asks for username and password and goes to cloudflare 502 page.

from caprover.

buglinjo avatar buglinjo commented on May 15, 2024

Changed host IP to 0.0.0.0 it works like a charm! Thank you!

from caprover.

direnc avatar direnc commented on May 15, 2024

Where do I need to change the host IP?

from caprover.

hamza-younas94 avatar hamza-younas94 commented on May 15, 2024

Where do I need to change the host IP?

in nginx configuration section

from caprover.

Jonneal3 avatar Jonneal3 commented on May 15, 2024

This did NOT work for me. Does anyone have any other suggestions?

from caprover.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.