Open AmirNaghibi opened 3 years ago
closing this issue because it is working. I think it took some time to update... š¤
amir.business works but www.amir.business doens't. I created a CNAME but still www.amir.business doesn't work...
Āædns? I see, register the www. in your domain provider so that they can migrate with cloudflare's dns and they are redirecting with their proxies. in cloudflare you can create the www. with workers if you have it configured.
I'm using Google Domain. If my domain is example.com shouldn't I own www.example.com as well?
there doesn't seem to be a setting in Google Domain to register www. all I did was to set up Cloudflare nameservers.
Estoy usando Google Domain. Si mi dominio es example.com, Āæno deberĆa ser yo tambiĆ©n el propietario de www.example.com ?
no parece haber una configuraciĆ³n en Google Domain para registrar www . todo lo que hice fue configurar los servidores de nombres de Cloudflare.
- ĀæQuĆ© quieres decir con "crear www . Con trabajadores"? ĀæTengo que escribir cĆ³digo JS para manejar www? if it is supposed to be yours but it must already be configured before configuring the dns in cloudflare Āæ?. at the time of registering the domain in cloudflare in dns you get the configuration of the domain and its ip and dns addresses and it should show you. but if not or if it does not leave you only register the without www. and then you try to verify the www.
I'm having the same problem. Everything was fine but I tried to fix the "Mismatch between origin and baseUrl (dev)." error and now i get this IP address error as well (DNS_PROBE_FINISHED_NXDOMAIN). No idea what i did wrong.
A few days ago the A record was set as "Proxied" but can't activate it anymore. I don't know if the CNAME content is correct as well. Any help would be good...
I'm also using Google Domains
Okey try deleting the cname, why do you have that cname? If not it will redirect you to www. First you should only have one configuration which is dns 1.1.1.1.1. Then when you make that change renew the scrip in workers and configure the route. Then purge all the cache.
The scrip must be the original one from fruitionsite.com so you don't get an error.
-Don't worry if it says proxy or something else the important thing is that it goes to the dns.
I'm having the same problem. Everything was fine but I tried to fix the "Mismatch between origin and baseUrl (dev)." error and now i get this IP address error as well (DNS_PROBE_FINISHED_NXDOMAIN). No idea what i did wrong.
A few days ago the A record was set as "Proxied" but can't activate it anymore. I don't know if the CNAME content is correct as well. Any help would be good...
I'm also using Google Domains
Just did all that =( I'm definitely missing something. I did aaaall the process from the scratch. I had it working once, when the A record was "Proxied", i guess its the only thing different...
Share with me your scrip to verify it and your dns settings.
What domain are you pointing to?
Just did all that =( I'm definitely missing something. I did aaaall the process from the scratch. I had it working once, when the A record was "Proxied", i guess its the only thing different...
Thanks for the help!
DNS Settings:
Script:
/ CONFIGURATION STARTS HERE /
/ Step 1: enter your domain name like fruitionsite.com / const MY_DOMAIN = 'julianasouza.me';
/*
The value on the right is the Notion page ID */ const SLUG_TO_PAGE = { '': '994987baf99d49d7aadcece36fc73784', 'en-us': '994987baf99d49d7aadcece36fc73784', 'about': 'e8cb53b1d2d4400592808042eed54838', 'pt-br': '48c3c42855ca47c3bc13db1286b348c8', 'sobre': '5ba9e0c354f745f5b12901b1207a0c3c', };
/ Step 3: enter your page title and description for SEO purposes / const PAGE_TITLE = 'Juliana Souza'; const PAGE_DESCRIPTION = 'Product Designer & Design System Ops';
/ Step 4: enter a Google Font name, you can choose from https://fonts.google.com / const GOOGLE_FONT = 'Nunito';
/ Step 5: enter any custom scripts you'd like /
const CUSTOM_SCRIPT = <script async defer type="text/javascript" id="chilipepper" src="https://chilipepper.io/fruition.js"></script>
;
/ CONFIGURATION ENDS HERE /
const PAGE_TO_SLUG = {}; const slugs = []; const pages = []; Object.keys(SLUG_TO_PAGE).forEach(slug => { const page = SLUG_TO_PAGE[slug]; slugs.push(slug); pages.push(page); PAGE_TO_SLUG[page] = slug; });
addEventListener('fetch', event => { event.respondWith(fetchAndApply(event.request)); });
function generateSitemap() {
let sitemap = '
const corsHeaders = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, HEAD, POST, PUT, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type', };
function handleOptions(request) { if (request.headers.get('Origin') !== null && request.headers.get('Access-Control-Request-Method') !== null && request.headers.get('Access-Control-Request-Headers') !== null) { // Handle CORS pre-flight request. return new Response(null, { headers: corsHeaders }); } else { // Handle standard OPTIONS request. return new Response(null, { headers: { 'Allow': 'GET, HEAD, POST, PUT, OPTIONS', } }); } }
async function fetchAndApply(request) { if (request.method === 'OPTIONS') { return handleOptions(request); } let url = new URL(request.url); url.hostname = 'www.notion.so'; if (url.pathname === '/robots.txt') { return new Response('Sitemap: https://' + MY_DOMAIN + '/sitemap.xml'); } if (url.pathname === '/sitemap.xml') { let response = new Response(generateSitemap()); response.headers.set('content-type', 'application/xml'); return response; } let response; if (url.pathname.startsWith('/app') && url.pathname.endsWith('js')) { response = await fetch(url.toString()); let body = await response.text(); response = new Response(body.replace(/www.notion.so/g, MY_DOMAIN).replace(/notion.so/g, MY_DOMAIN), response); response.headers.set('Content-Type', 'application/x-javascript'); return response; } else if ((url.pathname.startsWith('/api'))) { // Forward API response = await fetch(url.toString(), { body: url.pathname.startsWith('/api/v3/getPublicPageData') ? null : request.body, headers: { 'content-type': 'application/json;charset=UTF-8', 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36' }, method: 'POST', }); response = new Response(response.body, response); response.headers.set('Access-Control-Allow-Origin', '*'); return response; } else if (slugs.indexOf(url.pathname.slice(1)) > -1) { const pageId = SLUG_TO_PAGE[url.pathname.slice(1)]; return Response.redirect('https://' + MY_DOMAIN + '/' + pageId, 301); } else { response = await fetch(url.toString(), { body: request.body, headers: request.headers, method: request.method, }); response = new Response(response.body, response); response.headers.delete('Content-Security-Policy'); response.headers.delete('X-Content-Security-Policy'); }
return appendJavascript(response, SLUG_TO_PAGE); }
class MetaRewriter { element(element) { if (PAGE_TITLE !== '') { if (element.getAttribute('property') === 'og:title' || element.getAttribute('name') === 'twitter:title') { element.setAttribute('content', PAGE_TITLE); } if (element.tagName === 'title') { element.setInnerContent(PAGE_TITLE); } } if (PAGE_DESCRIPTION !== '') { if (element.getAttribute('name') === 'description' || element.getAttribute('property') === 'og:description' || element.getAttribute('name') === 'twitter:description') { element.setAttribute('content', PAGE_DESCRIPTION); } } if (element.getAttribute('property') === 'og:url' || element.getAttribute('name') === 'twitter:url') { element.setAttribute('content', MY_DOMAIN); } if (element.getAttribute('name') === 'apple-itunes-app') { element.remove(); } } }
class HeadRewriter { element(element) { if (GOOGLE_FONT !== '') { element.append(`
`, { html: true }); } element.append(``, { html: true }) } } class BodyRewriter { constructor(SLUG_TO_PAGE) { this.SLUG_TO_PAGE = SLUG_TO_PAGE; } element(element) { element.append(` ${CUSTOM_SCRIPT}`, { html: true }); } } async function appendJavascript(res, SLUG_TO_PAGE) { return new HTMLRewriter() .on('title', new MetaRewriter()) .on('meta', new MetaRewriter()) .on('head', new HeadRewriter()) .on('body', new BodyRewriter(SLUG_TO_PAGE)) .transform(res); }Problem solved!!! It was a problem in the DNS setting on my Google Domain š¤¦š»āāļø
All good now :)
Ā”Gracias por la ayuda!
ConfiguraciĆ³n de DNS:
Texto:
/ LA CONFIGURACIĆN COMIENZA AQUĆ /
/ Paso 1: ingrese su nombre de dominio como fruitionsite.com / const MY_DOMAIN = 'julianasouza.me';
/ *
- Paso 2: ingrese su slug de URL a la asignaciĆ³n de ID de pĆ”gina
- La tecla de la izquierda es la babosa (sin la barra)
- El valor de la derecha es el ID de la pƔgina de Notion
- / const SLUG_TO_PAGE = { '': '994987baf99d49d7aadcece36fc73784', 'en-us': '994987baf99d49d7aadcece36fc73784', 'about': 'e8cb53b2d380', ' about': 'e8cb53b1b2802d42c ': 'e8cb53b1b2802d4c4c055' , 'sobre': '5ba9e0c354f745f5b12901b1207a0c3c', };
/ Paso 3: ingrese el tĆtulo y la descripciĆ³n de su pĆ”gina para propĆ³sitos de SEO / const PAGE_TITLE = 'Juliana Souza'; const PAGE_DESCRIPTION = 'DiseƱador de productos y operaciones del sistema de diseƱo';
/ Paso 4: ingrese un nombre de fuente de Google, puede elegir entre https://fonts.google.com / const GOOGLE_FONT = 'Nunito';
/ Paso 5: ingrese los scripts personalizados que desee / const CUSTOM_SCRIPT =
<script async defer type="text/javascript" id="chilipepper" src="https://chilipepper.io/fruition.js"></script>
;/ LA CONFIGURACIĆN TERMINA AQUĆ /
const PAGE_TO_SLUG = {}; babosas const = []; pƔginas constantes = []; Object.keys (SLUG_TO_PAGE) .forEach (slug => { pƔgina constante = SLUG_TO_PAGE [slug]; slugs.push (slug); pages.push (pƔgina); PAGE_TO_SLUG [pƔgina] = slug; });
addEventListener ('fetch', event => { event.respondWith (fetchAndApply (event.request)); });
funciĆ³n generateSitemap () { dejar mapa del sitio = ''; slugs.forEach ( (slug) => (mapa del sitio + = 'https: //' + MI_DOMINIO + '/' + slug + '') ); mapa del sitio + = ''; regresar mapa del sitio; }
const corsHeaders = { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, HEAD, POST, PUT, OPTIONS', 'Access-Control-Allow-Headers': 'Content-Type', };
function handleOptions (solicitud) { if (request.headers.get ('Origen')! == null && request.headers.get ('Access-Control-Request-Method')! == null && request.headers.get ( 'Access-Control-Request-Headers')! == null) { // Manejar la solicitud previa al vuelo de CORS. devolver nueva Respuesta (nulo, { encabezados: corsHeaders }); } else { // Manejar la solicitud de OPCIONES estƔndar. devuelve una nueva respuesta (nula, { encabezados: { 'Permitir': 'OBTENER, ENCABEZAR, PUBLICAR, PONER, OPCIONES', } }); } }
funciĆ³n asĆncrona fetchAndApply (solicitud) { if (request.method === 'OPTIONS') { return handleOptions (request); } let url = new URL (request.url); url.hostname = 'www.notion.so'; if (url.pathname === '/robots.txt') { return new Response ('Sitemap: https: //' + MY_DOMAIN + '/sitemap.xml'); } if (url.pathname === '/sitemap.xml') { let response = new Response (generateSitemap ()); response.headers.set ('tipo de contenido', 'aplicaciĆ³n / xml'); respuesta de retorno; } dejar respuesta; if (url.pathname.startsWith ('/ app') && url.pathname.endsWith ('js')) { response = await fetch (url.toString ()); response = new Response (body.replace (/www.notion.so/g, MY_DOMAIN) .replace (/notion.so/g, MY_DOMAIN), respuesta); response.headers.set ('Content-Type', 'application / x-javascript'); respuesta de retorno; } else if ((url.pathname.startsWith ('/ api'))) { // Forward API response = await fetch (url.toString (), { body: url.pathname.startsWith ('/ api / v3 / getPublicPageData ')? null: request.body, headers: { ' content-type ':' application / json; charset = UTF-8 ', ' user-agent ':' Mozilla / 5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit /537.36 (KHTML, como Gecko) Chrome / 80.0.3987.163 Safari / 537.36 ' }, mĆ©todo:' POST ', }); response.headers.set ('Acceso-Control-Permitir-Origen', '*'); respuesta de retorno; } else if (slugs.indexOf (url.pathname.slice (1))> -1) { const pageId = SLUG_TO_PAGE [url.pathname.slice (1)]; return Response.redirect ('https: //' + MY_DOMAIN + '/' + pageId, 301); } else { respuesta = esperar a buscar (url.toString (), { cuerpo: solicitud.cuerpo, encabezados: solicitud.cabeceras, mĆ©todo: solicitud.metodo, }); respuesta = nueva respuesta (respuesta.cuerpo, respuesta); response.headers.delete ('PolĆtica de seguridad de contenido'); response.headers.delete ('X-Content-Security-Policy'); }
return appendJavascript(response, SLUG_TO_PAGE);
}
class MetaRewriter { element (element) { if (PAGE_TITLE! == '') { if (element.getAttribute ('property') === 'og: title' || element.getAttribute ('name') === ' twitter: tĆtulo ') { element.setAttribute (' contenido ', PAGE_TITLE); } if (element.tagName === 'title') { element.setInnerContent (PAGE_TITLE); } } if (PAGE_DESCRIPTION! == '') { if (element.getAttribute ('nombre') === 'descripciĆ³n' || elemento.getAttribute ('propiedad') === 'og: descripciĆ³n' || elemento. getAttribute ('nombre') === 'twitter: descripciĆ³n') { element.setAttribute ('contenido', DESCRIPCIĆN_PĆGINA); || element.getAttribute ('nombre') === 'twitter: url') { element.setAttribute ('contenido', MI_DOMINIO); } if (element.getAttribute ('nombre') === 'apple-itunes-app') { element.remove (); } } }
class HeadRewriter { elemento (elemento) { if (GOOGLE_FONT! == '') { elemento.append (
<link href="https://fonts.googleapis.com/css?family=${GOOGLE_FONT.replace(' ', '+')}:Regular,Bold,Italic&display=swap" rel="stylesheet"> <style>* { font-family: "${GOOGLE_FONT}" !important; }</style>
, { html: true }); } element.append (<style> div.notion-topbar > div > div:nth-child(3) { display: none !important; } div.notion-topbar > div > div:nth-child(4) { display: none !important; } div.notion-topbar > div > div:nth-child(5) { display: none !important; } div.notion-topbar > div > div:nth-child(6) { display: none !important; } div.notion-topbar-mobile > div:nth-child(3) { display: none !important; } div.notion-topbar-mobile > div:nth-child(4) { display: none !important; } div.notion-topbar > div > div:nth-child(1n).toggle-mode { display: block !important; } div.notion-topbar-mobile > div:nth-child(1n).toggle-mode { display: block !important; } </style>
, { html: true }) } }class BodyRewriter { constructor (SLUG_TO_PAGE) { this.SLUG_TO_PAGE = SLUG_TO_PAGE; } elemento (elemento) { elemento.append (
<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div> <script> window.CONFIG.domainBaseUrl = 'https://${MY_DOMAIN}'; const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)}; const PAGE_TO_SLUG = {}; const slugs = []; const pages = []; const el = document.createElement('div'); let redirected = false; Object.keys(SLUG_TO_PAGE).forEach(slug => { const page = SLUG_TO_PAGE[slug]; slugs.push(slug); pages.push(page); PAGE_TO_SLUG[page] = slug; }); function getPage() { return location.pathname.slice(-32); } function getSlug() { return location.pathname.slice(1); } function updateSlug() { const slug = PAGE_TO_SLUG[getPage()]; if (slug != null) { history.replaceState(history.state, '', '/' + slug); } } function onDark() { el.innerHTML = '<div title="Change to Light Mode" style="margin-left: auto; margin-right: 14px; min-width: 0px;"><div role="button" tabindex="0" style="user-select: none; transition: background 120ms ease-in 0s; cursor: pointer; border-radius: 44px;"><div style="display: flex; flex-shrink: 0; height: 14px; width: 26px; border-radius: 44px; padding: 2px; box-sizing: content-box; background: rgb(46, 170, 220); transition: background 200ms ease 0s, box-shadow 200ms ease 0s;"><div style="width: 14px; height: 14px; border-radius: 44px; background: white; transition: transform 200ms ease-out 0s, background 200ms ease-out 0s; transform: translateX(12px) translateY(0px);"></div></div></div></div>'; document.body.classList.add('dark'); __console.environment.ThemeStore.setState({ mode: 'dark' }); }; function onLight() { el.innerHTML = '<div title="Change to Dark Mode" style="margin-left: auto; margin-right: 14px; min-width: 0px;"><div role="button" tabindex="0" style="user-select: none; transition: background 120ms ease-in 0s; cursor: pointer; border-radius: 44px;"><div style="display: flex; flex-shrink: 0; height: 14px; width: 26px; border-radius: 44px; padding: 2px; box-sizing: content-box; background: rgba(135, 131, 120, 0.3); transition: background 200ms ease 0s, box-shadow 200ms ease 0s;"><div style="width: 14px; height: 14px; border-radius: 44px; background: white; transition: transform 200ms ease-out 0s, background 200ms ease-out 0s; transform: translateX(0px) translateY(0px);"></div></div></div></div>'; document.body.classList.remove('dark'); __console.environment.ThemeStore.setState({ mode: 'light' }); } function toggle() { if (document.body.classList.contains('dark')) { onLight(); } else { onDark(); } } function addDarkModeButton(device) { const nav = device === 'web' ? document.querySelector('.notion-topbar').firstChild : document.querySelector('.notion-topbar-mobile'); el.className = 'toggle-mode'; el.addEventListener('click', toggle); nav.appendChild(el); onLight(); } const observer = new MutationObserver(function() { if (redirected) return; const nav = document.querySelector('.notion-topbar'); const mobileNav = document.querySelector('.notion-topbar-mobile'); if (nav && nav.firstChild && nav.firstChild.firstChild || mobileNav && mobileNav.firstChild) { redirected = true; updateSlug(); addDarkModeButton(nav ? 'web' : 'mobile'); const onpopstate = window.onpopstate; window.onpopstate = function() { if (slugs.includes(getSlug())) { const page = SLUG_TO_PAGE[getSlug()]; if (page) { history.replaceState(history.state, 'bypass', '/' + page); } } onpopstate.apply(this, [].slice.call(arguments)); updateSlug(); }; } }); observer.observe(document.querySelector('#notion-app'), { childList: true, subtree: true, }); const replaceState = window.history.replaceState; window.history.replaceState = function(state) { if (arguments[1] !== 'bypass' && slugs.includes(getSlug())) return; return replaceState.apply(window.history, arguments); }; const pushState = window.history.pushState; window.history.pushState = function(state) { const dest = new URL(location.protocol + location.host + arguments[2]); const id = dest.pathname.slice(-32); if (pages.includes(id)) { arguments[2] = '/' + PAGE_TO_SLUG[id]; } return pushState.apply(window.history, arguments); }; const open = window.XMLHttpRequest.prototype.open; window.XMLHttpRequest.prototype.open = function() { arguments[1] = arguments[1].replace('${MY_DOMAIN}', 'www.notion.so'); return open.apply(this, [].slice.call(arguments)); }; </script>${CUSTOM_SCRIPT}
, { html: true }); } }funciĆ³n asĆncrona appendJavascript (res, SLUG_TO_PAGE) { return new HTMLRewriter () .on ('title', new MetaRewriter ()) .on ('meta', new MetaRewriter ()) .on ('head', new HeadRewriter ()) .on ('cuerpo', nuevo BodyRewriter (SLUG_TO_PAGE)) .transform (res); }
SƬ, ho appena guardato il tuo dominio e mi ha dato un accesso normale.
Bel design, salute!
Problem solved!!! It was a problem in the DNS setting on my Google Domain š¤¦š»āāļø All good now :)
Questa ĆØ una buona notizia, Salute Grazie a voi
@julianasouza-s hi juliana! how did you solve the DNS setting on your google Domain? I am having the same error and not sure where to go next :)
I think I have an issue with DNS settings. When I go to my domain (www.amir.business)
I followed the instructions today but still had no luck.