Skip to main content
  1. My Blog Posts and Stories/

Errors with this blog

··394 words·2 mins

Mistakes, mistakes everywhere…. #

After sharing my blog with my friends, my friends told me that there were many issues with the blog >< Some of them are listed below:

  1. Typo (Ez fix)
  2. Buttons are not working correctly (A bit harder to fix)
  3. HTTP does not redirect to HTTPS

Frontend fixes #

As the front end noob that I am, idk how to fix buttons. All I wanted was a button that can go back to the main blog page. This was what the element was initially:

<!-- Nothing related to forms above it -->
    Back to posts

Welp after realizing that it didn’t work, what should I do? Well like anyone else I used the onclick method in the button

<!-- Nothing related to forms above it -->
    onclick="{redirect code here}"
    Back to posts

That should work right? Not exactly…… I have no idea what is wrong with the button. Maybe it was my code? Maybe the attribute was defined wrongly?

Stupid mistake incoming #

After an hour of deliberation…… I found this.

My CSP decided to block me from doing on action…… Oh boy this is hard. Mad respect to everyone who is doing front end (Or maybe I’m just not good in front end).

Suffering from success
Suffering from success Cover

Why is my CSP so good. No choice, lets make an <a> attribute look like a button.

Button code:

<a href="/blog" class="btn btn-primary">Back to Posts</a>

So thats how I fixed my buttons. A few hours for just correcting a button…. RIP Productivity. How do all those people doing front end get them done so quickly????

Rip HTTP Version #

Time to fix my next issue. My HTTP version of the website is not redirecting to the HTTPS version of the website.

Just some background on HTTP and HTTPS

HTTP runs at port 80 by default and HTTPS runs at port 443 by default. In order to redirect the website from HTTP to HTTPS, I just decided to make another server that listens at port 80 and redirect the user to port 443 in the HTTPS version.

So here is the code:

def redirect_to_https(path: str):
    return redirect(f'{path}')

Can’t believe it worked on my first try. Yayy (celebration noises), maybe the deliberation in the buttons has made me warier of my mistakes. Woohoo 1 more small victory for me.