top | item 13820924

Use App Engine and Go to Host a Static Website with Same Domain Redirects

86 points| aliasnexus0 | 9 years ago |thornelabs.net | reply

25 comments

order
[+] PuffinBlue|9 years ago|reply
This is well done.

If you want it 'done for you' or have a site that doesn't fit in the free tier on GAE but don't want to spend money - take a look at Netlify.

Free tier is generous, has CDN, free auto-provisioned SSL, builds automatically from a git repo (GitHUb/GitLab etc) and you can simply upload a _redirects file to handle redirects[0].

It'll even build a 'preview' of a branch, so just create a branch, make your changes and merge request, then Netlify will build a temporary site to view the changes - useful if you need to show someone what the changes to the site will look like.

I just switched from GitLab pages, and even changed domain from the apex to www (to get full DDoS/CDN benefit out of Netlify this is needed) - which is handled automatically.

If you want to have a poke around/speedtest of a site using it I'll link below[1].

[0] https://www.netlify.com/docs/redirects/

[1] https://www.josharcher.uk

[+] chrisp_dc|9 years ago|reply
I host my static website using Firebase and Google Domains. Google has easy integration between the two and seems to include all the listed benefits out-of-box.
[+] tyingq|9 years ago|reply
Thrifty way to do this. Seems the golang code, though, isn't setting any expires or cache-control headers (for the static content it's serving), so your browser ends up re-downloading a lot of assets that it doesn't need to.

Might be nice to add that bit in. Better performance for visitors, and would keep you in the free tier longer if traffic grows.

[+] aliasnexus0|9 years ago|reply
You are correct, and great points. This is my first Golang app, so doing what you suggested is my next step. Thanks!
[+] grw_|9 years ago|reply
The app.yaml routing allows "fall-through" routing, where your application's handler is only invoked if no static files match:

  - url: /static
    static_dir: static/
  - url: /.*
    script: _go_app
The redirect 'map' smells bad- better to simply serve the file if path exists, redirect if it doesn't.
[+] briandoll|9 years ago|reply
Or just use Netlify: https://www.netlify.com/
[+] StavrosK|9 years ago|reply
Seconded, lately I've been using Lektor+netlify for all my sites. Deploying is just a git push, and it's zero-headache. Greatly recommended.
[+] caleblloyd|9 years ago|reply
My recommendation to a friend for static hosting would be to use shared hosting for $5/mo.

Pick one that does automatic SSL with LetsEncrypt. I'm partial to Dreamhost because I've been on them for many years, but there are lots of good ones out there.

[+] kej|9 years ago|reply
I know $5/month isn't all that much, but I still like to suggest Nearly Free Speech. Most static sites can be hosted for pennies per month.
[+] bjpirt|9 years ago|reply
Or even simpler you can use S3 redirects to send all of your old URLs to their new location on the same host. I'm currently doing this from both an old domain to a new domain and within the same domain and "It Just Works" (tm)
[+] tapirl|9 years ago|reply
app engine static files are dispatched by google cdn network for free. CloudFront is not free.
[+] james_niro|9 years ago|reply
I prefer Heroku over google cloud, better documentation and deploying is really easy.
[+] PuffinBlue|9 years ago|reply
Any time I hear 'Heroku' it's mentally followed by that 'it's going to be expensive' intake of air sound.

Is that prejudgement borne out in reality?

[+] type0|9 years ago|reply
Often when I recommend GAE to someone the answer is: "but it's Google they are known to abandon their services". That and also the fear of being locked into Googles Cloud ecosystem pushes many potential customers away.