Has anyone tried to use actix-web crate

When I deploy the program on the server, a 502 error occurs when accessing, but the port monitored by the service is running. The following is my main program configuration, I can access it normally when debugging and running on local machine.

use actix_web::{get, web, App, HttpServer, Responder};
use api::user_api;

async fn main() -> std::io::Result<()> {
    HttpServer::new(|| {
            .route("/hello", web::get().to(|| async { "api server run successed" }))
    .bind(("localhost", 8082))?

By the way, I don't use SSL

You're binding to localhost, are you accessing on localhost? In not familiar with actix-web specifically, but I expect you would have to bind to "" to accept remote connections.

1 Like

I seem to remember something. I'll try

ty :smile:

1 Like

No problem!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.