Solving real-world  dev problem #1

Solving real-world dev problem #1

I was all set to head out for drinks with my girlfriend on a Friday evening. I was feeling good and ready to let loose after a long week at work. As I was buckling my belt, I received an email from my teammate that brought my excitement to a halt.

"Hey, the Google Play Store just rejected our app," the email read, "Your privacy policy page contains javascript." I felt my heart drop as I read the words. This was the last thing I needed on a Friday evening.

But then, I remembered that I had an imaginary tech-savvy superhero friend who always had my back. I turned to my imaginary friend and asked for their help. Together, we came up with a plan to defeat the evil Google Play Store and get our app approved.

I put on my imaginary cape and grabbed my trusty laptop, and we set off to save the day.

So here's what happened in detail :) why so much drama?

Ah, the joys of website development! It's like a treasure hunt, with one challenge leading to another. But in this case, the prize at the end is a perfectly functioning privacy policy page.

So, the problem with the javascript injection on the privacy policy page was making life difficult for Google bots. And since Webflow is a no-code platform, removing the javascript wasn't an option. But have no fear, the solution was at hand!

The plan was to create a new HTML page with all the content, host it on Cloudflare Pages, and use our central NGINX server to proxy pass the privacy policy page URL to the Cloudflare hosted page URL.

Sounds simple enough, right? Well, not so fast. The root domain was on, not Cloudflare or our NGINX server, so the first step was to move the root domain to our NGINX server. And that's when things got interesting. Changing the domain in Webflow took the production site down for a few days, causing a bit of chaos, but hey, no harm done. Just kidding!

Once the site was pointing to our NGINX server, we proxy passed the main domain to listen to one of our subdomains, which was pointing to our Webflow project. And finally, we proxy passed the /privacy-policy page URL to the Cloudflare-hosted page URL.

Now can somebody explain what is NGINX proxy? Why not.

Imagine this scenario: you're a fighter pilot, flying alongside your trusty wingman on a dangerous mission. Suddenly, your wingman's engine starts to sputter, and they're falling behind, trying to make their way through a maze of incoming enemy fire.

But don't panic! With the help of the NGINX proxy pass, you can come to the rescue. Think of it as a secret path through the sky, allowing your wingman to bypass all the obstacles and reach their target with ease.

And that's it! With just a few lines of code, you've set up a secret passage through the sky, ensuring your wingman reaches their destination in record time. So go ahead, and be the wingman your friend deserves. Let the NGINX proxy pass and do the heavy lifting!

Here's a simple code example of how it works:

server {
  listen 80;

  location / {
    proxy_pass http://wingman-server;
    proxy_set_header Host $host;

This code tells NGINX to listen on port 80 and sets the server name as "". The location block is where the magic happens. The proxy_pass directive tells NGINX to forward all incoming requests to the "wingman-server". And with the proxy_set_header the directive, NGINX adds the original host header to the request, making sure your wingman knows where the traffic is coming from.

It was a journey, but in the end, the privacy policy page was up and running, Google bots were happy, and the website was back online. And isn't that what really matters?

And so, our journey to fix the privacy policy page came to an end, with a few twists and turns along the way. But just like the plans to have a drink with my friend's girlfriend, sometimes things don't go according to plan.

But just like how I didn't let a rejected email from a teammate ruin my Friday evening plans, I didn't let the challenges of website development get me down. Instead, I approached it with humor and determination, and in the end, we came out on top.

So, the next time you're faced with a coding crisis, remember this story. And remember, just like how I had a drink with my girlfriend anyway, you can tackle any coding problem with a smile and a good attitude. Cheers to a job well done and a Friday evening well spent!

Did you find this article valuable?

Support Harsh Vardhan Goswami by becoming a sponsor. Any amount is appreciated!