implement custom 404 pages#81

Merged
6543 merged 9 commits from crystal/pages-server:custom404 into main 2022-06-12 03:50:01 +02:00
Member

This is my attempt at solving #56. I made my commit against the v2.5a tag because I couldn't get pages-server to connect to my Gitea server for testing when I built against main.

  • The expected filename is 404.html, like GitHub Pages
  • Each repo/branch can have one 404.html file at it's root
  • If a repo does not have a pages branch, the 404.html file from the pages repository is used
  • You get status code 404 (unless you request /404.html which returns 200)
  • The error page is cached

WIP: Depends on #78, I'll get this ready to go as soon as that's merged.


close #56

This is my attempt at solving #56. I made my commit against the v2.5a tag because I couldn't get pages-server to connect to my Gitea server for testing when I built against main. - The expected filename is `404.html`, like GitHub Pages - Each repo/branch can have one `404.html` file at it's root - If a repo does not have a `pages` branch, the 404.html file from the `pages` repository is used - You get status code 404 (unless you request /404.html which returns 200) - The error page is cached ~~WIP: Depends on #78, I'll get this ready to go as soon as that's merged.~~ --- close #56
implement custom 404 pages
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
832a4ecd63
i'm sorry gofumpt
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
9ec026a31b
Merge branch 'main' into custom404
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
9d4830d198
Author
Member

I created a tag that contains just the initial commits for v2.5a here

In crystal/pages-server#1 I managed to get it working with the newer code by preemptively merging #78 and manually fixing a couple things that caused the main branch to not work at all for me.

I created a tag that contains just the initial commits for v2.5a [here](https://codeberg.org/crystal/pages-server/src/tag/v2.5a-custom404) In crystal/pages-server#1 I managed to get it working with the newer code by preemptively merging #78 and manually fixing a couple things that caused the main branch to not work at all for me.
Contributor

thanks for the initial work :)

I'll try to finish the refactor asap and then have a look into this :)

thanks for the initial work :) I'll try to finish the refactor asap and then have a look into this :)
Author
Member

@6543 Thanks. The work you have on the refactor looks good so far, but there are quirks in the way the path.Join() function and the Gitea authorization header work that prevents the server from connecting to Gitea at all in it's current state. I managed to iron that and a couple other problems I had during testing out in my custom404-refactor-fix branch if you want to take a look. If you don't like the way I went about solving those problems that's OK, I tried to make the commit messages detailed so you can easily understand what the problem is.

P.S. I was compiling with Go 1.17, maybe the path.Join() quirk doesn't exist in Go 1.18, I haven't tried it.

@6543 Thanks. The work you have on the refactor looks good so far, but there are quirks in the way the `path.Join()` function and the Gitea authorization header work that prevents the server from connecting to Gitea at all in it's current state. I managed to iron that and a couple other problems I had during testing out in my `custom404-refactor-fix` branch if you want to take a look. If you don't like the way I went about solving those problems that's OK, I tried to make the commit messages detailed so you can easily understand what the problem is. P.S. I was compiling with Go 1.17, maybe the `path.Join()` quirk doesn't exist in Go 1.18, I haven't tried it.
6543 added this to the v3.0 milestone 2022-06-11 15:01:04 +02:00
Contributor

@crystal please update your pull 💙

@crystal please update your pull 💙
Merge refactor fixes
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
12e6b4b0d3
crystal changed title from WIP: implement custom 404 pages to implement custom 404 pages 2022-06-11 23:43:19 +02:00
Author
Member

ez ❤️

ez ❤️
Merge branch 'main' into custom404
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
b5318c9f7a
Contributor

since integration tests did land, do you have a repo to test this against and add it into this tests?

https://codeberg.org/Codeberg/pages-server/src/branch/main/integration/get_test.go#L18-L28

since integration tests did land, do you have a repo to test this against and add it into this tests? https://codeberg.org/Codeberg/pages-server/src/branch/main/integration/get_test.go#L18-L28
Author
Member

Sure, I'll upload one of the test repos I've been using for development.

Sure, I'll upload one of the test repos I've been using for development.
integration test for custom 404 pages
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
349eb14969
oops
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
58993cc324
Author
Member

i can't believe i made gofumpt mad again, i should've checked it before i committed

i can't believe i made gofumpt mad again, i should've checked it before i committed
6543 approved these changes 2022-06-12 03:48:53 +02:00
Contributor

great work

great work
6543 merged commit 38fb28f84f into main 2022-06-12 03:50:01 +02:00
6543 referenced this pull request from a commit 2022-06-12 03:50:01 +02:00
Sign in to join this conversation.
No description provided.