Skip to content

Instantly share code, notes, and snippets.

View JoeyBurzynski's full-sized avatar
💭
Hacking away on @EdgeSEO tools.

Joey Burzynski JoeyBurzynski

💭
Hacking away on @EdgeSEO tools.
View GitHub Profile
@JoeyBurzynski
JoeyBurzynski / cloudflare-worker-ip-to-real-client-ip-address.js
Last active February 15, 2024 10:39
Resolving Cloudflare Worker IP Issues [Replace Cloudflare Worker IP with Real Client IP in X-Forwarded-For HTTP Header]
// Cloudflare Worker Sandbox Examples
// Learning here, not intended for production use.
// https://cloudflareworkers.com/#6bc84bcddcf251074b41adba568a9284:https://tutorial.cloudflareworkers.com
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
})
/**
@JoeyBurzynski
JoeyBurzynski / i-design-with-code.markdown
Created March 27, 2023 11:41
I DESIGN WITH CODE ❤
@JoeyBurzynski
JoeyBurzynski / renovate.json
Created February 15, 2023 09:58
Renovate Configuration
{
"extends": [
"config:base",
":pinAllExceptPeerDependencies",
"group:nodeJs",
"group:allApollographql",
"group:codemirror",
"group:fortawesome",
"group:fusionjs",
"group:glimmer",
@JoeyBurzynski
JoeyBurzynski / sample-hreflang-annotations-in-html-markup.html
Created February 6, 2023 08:07
Sample Hreflang Annotations via HTML Markup
<!-- x-default: default when no language matches -->
<link rel="alternate" hreflang="x-default" href="https://www.mordorintelligence.com"/>
<!-- English (en) -->
<link rel="alternate" hreflang="en" href="https://www.mordorintelligence.com"/>
<!-- Arabic: macrolanguage (ar) -->
<link rel="alternate" hreflang="ar" href="https://www.mordorintelligence.sa"/>
<!-- Chinese (zh) -->
@JoeyBurzynski
JoeyBurzynski / sample-hreflang-annotations-in-xml-sitemap.xml
Last active February 6, 2023 07:59
Sample hreflang annotations via XML sitemap
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://www.mordorintelligence.sa</loc>
<!-- Arabic: macrolanguage (ar) -->
<xhtml:link
rel="alternate"
hreflang="ar"
href="https://www.mordorintelligence.sa"/>
@JoeyBurzynski
JoeyBurzynski / globalErrorHandler.js
Created February 1, 2023 20:38
JavaScript: Global onerror handler
window.addEventListener('error', function(e) {
var errorText = [
e.message,
'URL: ' + e.filename,
'Line: ' + e.lineno + ', Column: ' + e.colno,
'Stack: ' + (e.error && e.error.stack || '(no stack trace)')
].join('\n');
// Example: log errors as visual output into the host page.
// Note: you probably don't want to show such errors to users, or
@JoeyBurzynski
JoeyBurzynski / how-to-deal-with-unhandled-exceptions-and-unhandled-promise-rejections-in-javascript.md
Last active October 7, 2022 07:54
JavaScript: How to Deal with Unhandled Exceptions & Unhandled Promise Rejections in JavaScript
@JoeyBurzynski
JoeyBurzynski / wpengine-reverse-proxy-configuration-2022.md
Created June 25, 2022 13:06
Tutorial: How to Configure a Reverse Proxy for Use with WPEngine/Wordpress Sites [2022]

Configuration: How to Configure a Reverse Proxy for Use with WPEngine/Wordpress Sites [2022]

Configure an external proxy from domain.com to install1.wpengine.com.

Make sure you send the Cache-Control $http_cache_control header in your requests to WP Engine. If this isn’t configured you will be permanently logged into /wp-admin and it will not auto logout. That can be a serious security concern.

Make sure you pass the X-Forwarded-For headers to WP Engine so that we see the actual IPs and not the proxy IP. If this isn’t in place, you will get blocked by WP Engine’s firewall.

@JoeyBurzynski
JoeyBurzynski / wpengine-stop-htaccess-rewrites.php
Created June 25, 2022 12:36
WP Plugin Stop htaccess rewrites
<?php
/**
* Stop htaccess rewrites
*
* @package wpengine-stop-htaccess-rewrites
* @author wpengine
* @license Proprietary
*
* @wordpress-muplugin