Suwayomi / Suwayomi-WebUI

Mozilla Public License 2.0
114 stars 49 forks source link

[Feature Request] host on sub page #174

Open binyaminyblatt opened 2 years ago

binyaminyblatt commented 2 years ago

It would make it much easier to host behind a reverse proxy that is not its own URL I'm sorry I don't know electron so I can't tell you what it would take to adjust to allow for this

renjfk commented 1 month ago

Just so you know, you can already do this without modifying anything on Suwayomi-WebUI with caddy (replace-response module enabled) using the following config:

handle_path /suwayomi/* {
  reverse_proxy {REAL_SUWAYOMI_ADDRESS}:4567 {
    header_up Accept-Encoding identity
    header_up Host {host}
  }
  replace {
    match {
      header Content-Type text/html*
      header Content-Type text/css*
      header Content-Type application/javascript*
      header Content-Type application/json*
    }
    # Replace the ones in HTML and CSS
    "href=\"/" "href=\"/suwayomi/"
    "src=\"/" "src=\"/suwayomi/"
    "url(/" "url(/suwayomi/"
    # react-router <BrowserRouter> basename hack
    re "basename:([^=]+)=\"/\"" "basename:$1=\"/suwayomi/\""
    # Replace the rest loaded dynamically in JS
    "/locales" "/suwayomi/locales"
    "/api/" "/suwayomi/api/"
    "\"assets/" "\"suwayomi/assets/"
  }
}