DioxusLabs / DioxusLabs/dioxus

nginx reverse proxy path issue

Open
#5,284 0 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**

Hello, first of all thanks a lot to the devs for this amazing framework!

I am serving two dioxus webpages behind a reverse proxy:

url:443 -> website A on port 8080
url:443/websiteb -> website B on port 8081

now website A works fine. But website B always points the assets to `url/assets` instead of `url/websiteb/assets`

I'm not sure if this is related to https://github.com/DioxusLabs/dioxus/issues/4240.

**Steps To Reproduce**

Steps to reproduce the behavior:

nginx config:

```
location /websiteb/ {

proxy_connect_timeout 60;

proxy_read_timeout 60;

proxy_send_timeout 60;

proxy_intercept_errors off;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection $connection_upgrade;

proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

proxy_pass http://192.168.1.115:8081;

}

location / {

proxy_connect_timeout 60;

proxy_read_timeout 60;

proxy_send_timeout 60;

proxy_intercept_errors off;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection $connection_upgrade;

proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

proxy_pass http://192.168.1.115:8080;

}

```

`Dioxus.toml`
the `base_path` gets ignored, it does not matter if put it in or not:
```toml
[application]

[web.app]

# HTML title tag content
title = "websiteb"
base_path = "websiteb"

# include `assets` in web platform
[web.resource]
static_dir = "assets"

# Additional CSS style files
style = []

# Additional JavaScript files
script = []

[web.resource.dev]

# Javascript code file
# serve: [dev-server] only
script = []

```

and `main.rs`

```rust
//
// ================= SERVER MAIN =================
//
#[cfg(feature = "server")]
#[tokio::main]
async fn main() {
use axum::Router;
use std::net::SocketAddr;
dotenv::dotenv().ok();

start_tabs_reload_task();

let port = std::env::var("PORT")
.ok()
.and_then(|p| p.parse::().ok())
.unwrap_or(8081);

let addr = SocketAddr::from(([0, 0, 0, 0], port));
println!("Listening on http://{}", addr);

let router = Router::new().serve_dioxus_application(ServeConfig::default(), App);

let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();

axum::serve(listener, router).await.unwrap();
}

//
// ================= WASM MAIN =================
//
#[cfg(not(feature = "server"))]
fn main() {
dioxus::launch(App);
}

```

**Expected behavior**

That it is possible to link to the assets on the same path

**Environment:**

- Dioxus version: 0.7.3
- Rust version: 1.92.0
- OS info: macOS, trixie docker
- App platform: web

**Questionnaire**

I'm interested in fixing this myself but don't know where to start.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.