Re:A tiny Docker image to serve static websites
by qbasic_forever on Tuesday April 12, 2022 @01:08PM
(#31005427)
I don't think you can set a page or URL on github to return a 301 moved permanently response or similar 3xx codes. This can really mess up your SEO if you have a popular page and try to move off github, you'll basically lose all the clout on the URL and have to start fresh. It might not matter for stuff you're just tossing out there but is definitely something to consider if you're putting a blog, public facing site, etc. there.
[ Parent
| on HN ]
Re:A tiny Docker image to serve static websites
by nobodywasishere on Tuesday April 12, 2022 @01:12PM
(#31005468)
I have a few 301 redirects setup on github pages
$ curl https://nobodywasishere.github.io # moved to https://blog.eowyn.net
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
$ curl https://blog.eowyn.net/vhdlref-jtd # moved to https://blog.eowyn.net/vhdlref
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
Re:A tiny Docker image to serve static websites
by qbasic_forever on Tuesday April 12, 2022 @01:16PM
(#31005530)
Is that coming back with a HTTP 200 response though and the made up HTML page? That doesn't seem right... at least, I dunno if google and such would actually index your page at the new URL vs. just thinking "huh weird looks like blog.eowyn.net is now called '301 Moved Permanently', better trash that down in the rankings".
Re:A tiny Docker image to serve static websites
by cptskippy on Tuesday April 12, 2022 @01:20PM
(#31005589)
It shows up as a proper 301 when I load up the URL in Firefox. The question is, how?
Re:A tiny Docker image to serve static websites
by MD87 on Tuesday April 12, 2022 @01:28PM
(#31005705)
One of the Jekyll plugins that GH Pages supports[0] is jekyll-redirect-from, which lets you put a `redirect_to` entry in a page's front matter.
Re:A tiny Docker image to serve static websites
by simonw on Tuesday April 12, 2022 @10:03PM
(#31010446)
I found this example of another repo that is using the same trick: https://github.com/kotokaze/kotokaze.github.io
~ % curl -i 'https://kotokaze.github.io/'
HTTP/2 301
server: GitHub.com
content-type: text/html
permissions-policy: interest-cohort=()
location: http://github.kotokaze.net/
Re:A tiny Docker image to serve static websites
by nobodywasishere on Tuesday April 12, 2022 @06:11PM
(#31008880)
For the latter, `<meta http-equiv="refresh" content="0; URL=https://blog.eowyn.net/vhdlref" />` in the `<head>`
Re:A tiny Docker image to serve static websites
by qbasic_forever on Tuesday April 12, 2022 @01:23PM
(#31005638)
Wow, nice yeah I'd love to know how github supports configuring a URL to 301 redirect!
Re:A tiny Docker image to serve static websites
by chabad360 on Tuesday April 12, 2022 @01:20PM
(#31005595)
Yea, no.
A 301 (or 302) redirect means setting the status code header to 301 and providing a location header with the place to redirect to. Last I checked GitHub doesn't allow any of this, or setting any other headers (like cache-control). To work around this, I've been putting cloudflare in front of my site which lets me use page rules to set redirects if necessary.