sensebox / books

senseBox documentation as beautiful books
https://books.sensebox.de
Other
11 stars 10 forks source link

faulty redirect from books.sensebox.de to sensebox.github.io/books #9

Closed noerw closed 7 years ago

noerw commented 7 years ago

when no trailing slash is provided in a call to https://books.sensebox.de/*, the URL gets redirected to http://sensebox.github.io/books/*/, which may get confusing to the user. @ubergesundheit

ubergesundheit commented 7 years ago

Maybe you could investigate a little too?

ubergesundheit commented 7 years ago

This is the Caddy config for books.sensebox.de

www.books.sensebox.de, books.sensebox.de {
  gzip
  log / stdout
  errors / stdout
  proxy / https://sensebox.github.io/books
}
noerw commented 7 years ago

github enforces a trailing slash and redirects with their full domain, not only the path. so our proxy has to perform this redirect before github does. this applies to any ghpages site with a custom domain.

try this:

www.books.sensebox.de, books.sensebox.de {
  gzip
  log / stdout
  errors stdout

  # enforce trailing slash
  redir {
    if {path} match \/[^\.\/]+$
    / {path}/
  }

  proxy / https://sensebox.github.io/books
}

interestingly, they also redirect https://example.com/foo -> http://example.com/foo/ which is obviously unsafe. not shure if the above config covers that, as i tested locally without TLS

ubergesundheit commented 7 years ago

This doesn't work :( You are right with the trailing slash.

Maybe we should look into serving all static html currently hosted on gh pages through the https://caddyserver.com/docs/git plugin of caddy.

@mpfeil Objections?

@noerw Could you look into the git plugin and suggest modifications?

mpfeil commented 7 years ago

looks fine to me. let's give it a try

mpfeil commented 7 years ago

Redirect is working right now. We are using git plugin of caddy now.