Questions tagged [actix-web]
488 questions
0
votes
1 answer
.bind_rustls() on 443 times out/does not serve on public ip (using a certbot certificate)
tl; dr: My website is successfully served on ether localhost with https, or domain/ip with http, but not domain/ip with https. Code's at the bottom.
I have an A record to @ (gremy.co.uk) and to www in my registrar and it resolves correctly when…

Gremious
- 304
- 3
- 10
0
votes
0 answers
Where's the bottleneck when I wait for a Kafka message then return a value in Actix Web?
I am trying to communicate between 2 microservices written in Rust and Node.js using Kafka.
I'm using actix-web as web framework and rdkafka as Kafka client for Rust. On the Node.js side, it queries stuff from the database and returns it as JSON to…

SaltyAom
- 81
- 2
- 4
0
votes
0 answers
How to pass data from request to response without copying in actix_web
I have a User structure that is deserialized from the request body. I want to fill the data of the User structure (field name) according to the data received from the database and return the response.
Without copying, borrow the username from the…

TupleCats
- 351
- 3
- 15
0
votes
1 answer
Actix: what's the right way to move shared data into multiple threads?
I have a config Struct that I'm sharing across my actix app like so:
pub fn run(addr: &str, pg_pool: PgPool, config: Settings) -> Result {
let pool = web::Data::new(pg_pool);
let arc_config =…

ilmoi
- 1,994
- 2
- 21
- 45
0
votes
0 answers
How do I modify actix-web's Query extractor behavior to handle case differences?
The following is an example from actix-web's docs on how to deserialize Query data into a struct:
use actix_web::{get, web, App, HttpServer};
use serde::Deserialize;
#[derive(Deserialize)]
struct Info {
username: String,
}
// this handler gets…

ilmoi
- 1,994
- 2
- 21
- 45
0
votes
0 answers
How do I resolve “implementation of serde::Deserialize is not general enough” with actix-web's Form type?
I'm building a web server using actix-web. One of my endpoints tries to deserialize the incoming data into a form struct:
#[get("/tweets4")]
async fn tweets4(form: web::Form>) -> HttpResponse {
println!("{} {} {}", form.page,…

ilmoi
- 1,994
- 2
- 21
- 45
0
votes
1 answer
How to update Actix app_data with POST request?
I am trying to create a Actix server that I want to use as an interface for a global HashMap.
I have been able to create a route that returns the entire structure. However, now I am having problems updating the HashMap. I am able to submit and…

bleuj
- 151
- 6
0
votes
0 answers
What's the best way of handling errors in main method of actix-web?
Is there a way to handle errors inside main method in actix-web?
I have the following code, as you can see there's three places in that function that can panic: the reference to the DATABASE_URL environment variable, the creation of the connection…

zuko
- 13
- 3
0
votes
0 answers
Actix Request Error the trait `std::future::Future` is not implemented for `Request<()>`
I'm very new to Rust and am trying to make a post request to an internal API. I'm getting the error:
match request.await {
^^^^^^^^^^^^^ `Request<()>` is not a future
= help: the trait `std::future::Future` is not…

AMP_035
- 167
- 1
- 2
- 13
0
votes
1 answer
Cors headers not set with Actix_Cors using Actix_Web server written in Rust
I have written a web server in Rust using Actix_Web. Im preparing it for production so I wanted to add Cors to the server to improve security. I have used the Actix_Cors package to do that and implemented a test with a basic server. When calling the…

Ultronn
- 532
- 1
- 5
- 19
0
votes
0 answers
Resource Regex Cause Panic
This code is an attempt to replace a service that already works in production, written in java, with one written in rust.
This service will serve as a sidecar proxy for a redis cluster, exposing an api rest. It needs to maintain compatibility with…

Rogério Ferreira
- 153
- 1
- 7
0
votes
1 answer
Share memory data by REST parameters in Rust
my "main" file
mod router;
mod student;
use std::sync::Arc;
use crate::router::init_router;
use crate::router::Memory;
use actix_web::{App, HttpServer};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
dotenv::dotenv().ok();
…

Daniel
- 181
- 4
- 13
0
votes
1 answer
Actix server fails to connect to Postgres when using TLS via deadpool-postgres
I have a web app. I have developed out some basic features in production. I have put it into a live environment, once on Heroku and later on DigitalOcean. In live, the connection to the Postgres database needs to use TLS. In all permutations of code…

MBuscemi
- 102
- 8
0
votes
1 answer
Can't write field to MongoDB document if using skip_serialize serde attribute in Rust
I want to be able to write a field into a mongo document, but avoid serializing it when passing the object as a response to the client.
I tried using #[serde(skip_serializing)].
However, it doesn't work as I intended, which I think is because when…
0
votes
1 answer
How can I get the request body as Json while also getting the cookie in Actix-web?
I'm a college student, currently trying to rewrite a toy Django website using Actix-web, and I'm facing problems.
The original Python code looks like this(irrelevant parts removed). It receives a request as the parameter, extract the 'title' and…