Skip to content

Blog

New website

So, I finally registered a domain - my website now lives at toonarmycaptain.com!

Took a bit of mucking around, but I have it still (for the moment) deployed in the same place on PythonAnywhere. But I had a lot of trouble with some CSRF stuff.

Turns out the issue was because the Flask-WTF library that I'm using to handle forms checks that the Origin header matches its own hostname. This ensures that the site submitting to the server isn't a fake, because the client's browser will set the origin as whatever hostname it's seeing (eg Origin: myfakesite.com).

The fix was to have my cloudflare proxy rewrite the Origin/Referer headers sent to the backend to the backend's hostname. That way the server is happy because it's not seeing cloudflare as the origin (it's expecting the origin to match its own hostname), and the client doesn't know the difference.

const origin = headers.get('Origin');                                                                                                                                                       
    if (origin) {                               
        headers.set('Origin', origin.replaceAll(originalHost, targetHost));                                                                                                                     
    }                                                                                                                                                                                         
    const referer = headers.get('Referer');                                                                                                                                                     
    if (referer) {
        headers.set('Referer', referer.replaceAll(originalHost, targetHost));                                                                                                                   
    } 

What you need to learn that's not writing code.

A mate told me they're trying to pick up coding. While I'm not yet employed with my skills, I thought I'd write down my thoughts about what they need to learn.

[They're planning on learning HTML/CSS/JS and Python for front end development, and have started with Python.]

What do they need to learn?

Getting things done. Or, "how to solve problems".

It's very easy for me to set myself tasks. Build that website. Write a blog post. Clean the house. Learn about that library or a new technology. Get a degree. Get the outside of the house ready for winter. Find a job. So easy. There, done.

Or...not?

One of the problems with this way of (not) planning is that it sets tasks or identifies problems, without a map to to a solution.

Hello world!

I've been planning on writing this for ... awhile.

There's a lot of advice around regarding getting into tech suggesting blogging and building your own website. I'm working on the latter. On the former, I'm finally following the part of the advice that says "just start writing" and "use other services rather than building a blog yourself". So here we are.