Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All fruition website down #107

Open
leoleung25 opened this issue Aug 13, 2021 · 44 comments
Open

All fruition website down #107

leoleung25 opened this issue Aug 13, 2021 · 44 comments

Comments

@leoleung25
Copy link

I have my website hosted with the fruition script and it just went down showing "Mismatch between origin and baseURL (Dev)." Even the fruition website and most of the showcase websites are down. Please fix. Thanks

@willzhaoworld
Copy link

same issue as above

@tamagamis
Copy link

If it is correct and I do not see any post or something referring to the creator: C I do not want to know what the end is xd

here I see a post on reddit
https://www.reddit.com/r/Notion/comments/p3wgyn/is_it_just_happening_to_me_fruitionsitecom/

@bejaeger
Copy link

Same problem here, any information about how and when this can be fixed would be super appreciated!

@mohasxd
Copy link

mohasxd commented Aug 14, 2021

I have the same problem. Unfortunately things have been looing troubling for fruitionsite since Notion decided to add their own "custom" URLs. I hope there is a solution!!!!

@wentin
Copy link

wentin commented Aug 14, 2021

Thanks to Ryo from Notion, my site is working now:

https://startup.wentin.net/

This is how to fix it

my old code on Cloudflare:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

my new code:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      window.CONFIG.domainBaseUrl = "https://startup.wentin.net";
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

the line I added that fixed the issue

  window.CONFIG.domainBaseUrl = "https://startup.wentin.net";

@laughnan
Copy link

Your (and Ryo's) fix worked for me, @wentin! I changed the configuration slightly to pull from MY_DOMAIN but I have a pull request up for @stephenou: #109

@jruers
Copy link

jruers commented Aug 14, 2021

works fine for all old sites created in Notion ! 👍🏻
But when I create a new site with the new Notion domain it always shows: ERR_TOO_MANY_REDIRECTS
after uploading the worker code.
Any suggestions what is going wrong ?

@laughnan
Copy link

@jruers what is the new site URL that you're trying? When testing my PR code I used a brand new share URL and the latest worker.js code.

@jruers
Copy link

jruers commented Aug 14, 2021

@laughnan www.enfim.eu

@laughnan
Copy link

And what's the Notion URL that you're using @jruers ?

@tamagamis
Copy link

@laughnan www.enfim.eu

yes i see

_check your dns or domain address if there are no changes, it happened to me but the solution for me was to purge cache and how I have implemented it with cloudflare delete and create new workers_

and I also recommend that you regenerate the code after debugging and deleting workers so that everything is clean and as new and wait for it to be distributed

@jruers
Copy link

jruers commented Aug 14, 2021

@laughnan https://enfim.notion.site/eb6e671f1df340a0a3bd1362df05033b

@Creadors thx. I have tried that already, but we'll give it another try

@tamagamis
Copy link

@laughnan https://enfim.notion.site/eb6e671f1df340a0a3bd1362df05033b

@Creadors gracias. Ya lo he intentado, pero lo intentaremos de nuevo.

Okay, the problem is already with the domain or place where you have it hosted. It still checks in workers that it is redirecting to the domain that you have 'enfim.eu'; / from worker without the www. for something like that enfim.eu/* or * .enfim.eu

@jruers
Copy link

jruers commented Aug 14, 2021

@Creadors checked all configurations at the provider. but are all the same like e.g. enfim.nl
I only have these problems with new notion sites after they changed the domain setup. bcoolr.com or casa-m.es same not working. but old like enfim.nl working fine.

@disachantel
Copy link

Thanks to Ryo from Notion, my site is working now:

https://startup.wentin.net/

This is how to fix it

my old code on Cloudflare:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

my new code:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      window.CONFIG.domainBaseUrl = "https://startup.wentin.net";
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

the line I added that fixed the issue

  window.CONFIG.domainBaseUrl = "https://startup.wentin.net";

thank you for sharing! this fixed my problem.

@bungspaces
Copy link

Thanks to Ryo from Notion, my site is working now:

https://startup.wentin.net/

This is how to fix it

my old code on Cloudflare:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

my new code:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      window.CONFIG.domainBaseUrl = "https://startup.wentin.net";
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

the line I added that fixed the issue

  window.CONFIG.domainBaseUrl = "https://startup.wentin.net";

how to found this code? what file should i open?

@tamagamis
Copy link

Gracias a Ryo de Notion, mi sitio está funcionando ahora:
https://startup.wentin.net/
Así es como solucionarlo
mi antiguo código en Cloudflare:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

mi nuevo código:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      window.CONFIG.domainBaseUrl = "https://startup.wentin.net";
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

la línea que agregué que solucionó el problema

  window.CONFIG.domainBaseUrl = "https://startup.wentin.net";

¿cómo encontrar este código? ¿Qué archivo debo abrir?

https://github.com/stephenou/fruitionsite/blob/master/worker.js

@ozanozyegen
Copy link

Tried the recommended solutions
window.CONFIG.domainBaseUrl = "https://startup.wentin.net";
and @Creadors advice of purging and recreating the workers.

I am still getting the same error.
"Mismatch between origin and baseURL (Dev)."

Route is ozyegen.com/* (also tried *ozyegen.com/*).

Worker code `/* CONFIGURATION STARTS HERE */

/* Step 1: enter your domain name like fruitionsite.com */
const MY_DOMAIN = 'ozyegen.com';

/*

  • Step 2: enter your URL slug to page ID mapping
  • The key on the left is the slug (without the slash)
  • The value on the right is the Notion page ID
    */
    const SLUG_TO_PAGE = {
    '': '7d789df7219840e3a575ba6ed212b228',
    'welcome': '7d789df7219840e3a575ba6ed212b228',
    'about': '1cfafdeeab064b10b1f308edc02c7d1d',
    'contact': '52c81731cd81400cbaf619b92df8d2d0',
    'blog': 'd43b07d3578f40c8bf708ee588948399',
    };

/* Step 3: enter your page title and description for SEO purposes */
const PAGE_TITLE = 'Ozan Ozyegen';
const PAGE_DESCRIPTION = 'Ozan Ozyegen's Website ';

/* Step 4: enter a Google Font name, you can choose from https://fonts.google.com */
const GOOGLE_FONT = '';

/* Step 5: enter any custom scripts you'd like */
const CUSTOM_SCRIPT = `

<script async src="https://www.googletagmanager.com/gtag/js?id=G-4F9JPVB42M"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-4F9JPVB42M'); </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 = '';
slugs.forEach(
(slug) =>
(sitemap +=
'https://' + MY_DOMAIN + '/' + slug + '')
);
sitemap += '';
return 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 fullPathname = request.url.replace("https://" + MY_DOMAIN, "");
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: 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(<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;
}
element(element) {
element.append(<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div> <script> window.CONFIG.domainBaseUrl = "https://startup.wentin.net"; 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 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 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
});
}
}

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);
}
`

@laughnan
Copy link

@ozanozyegen you want it to be your custom domain, see this as a sample: #109

@tamagamis
Copy link

Probé las soluciones recomendadas
window.CONFIG.domainBaseUrl = "https://startup.wentin.net";
y los consejos de @Creadors de purgar y recrear a los trabajadores.

Sigo recibiendo el mismo error.
"Mismatch between origin and baseURL (Dev)."

La ruta es ozyegen.com/*(también probada *ozyegen.com/*).

Código de trabajador

Greetings, if I see that you still get the error. try the direct corrections of the base code and then customize it so that you do not have any errors.

Code Active: https://fruition-git-master-stephenou.vercel.app/ generate new code

@ozanozyegen
Copy link

@ozanozyegen you want it to be your custom domain, see this as a sample: #109

Thank you, problem solved.

idanwe added a commit to idanwe/fruitionsite that referenced this issue Aug 16, 2021
Fix escape that prevent the domain to be set
@jjamesss1
Copy link

jjamesss1 commented Aug 18, 2021

Hi, there!!

Thank you all for this quick response once the change on Notion was implemented. EXTREMELY helpful for a non-coder as me :).
I faced another issue, dDoes anyone knows how to solve this one?

"Continue to external site by following the link below"

https://pasteboard.co/KfRjfeV.jpg

Edit: created issue #116 for this.

@hhimanshu
Copy link

I still get an error. The steps I followed are below

  1. Deleted worker and re-created one
  2. Re-created script using the latest link. Saved and deployed
  3. Added route for *harit.dev/* and link the newly created worker

When I hit my website , I see blank page with following error on Developer Console. Have I missed something? Thanks

9e069ff6c2ad42c5ad04aad8a3c4276c:1 GET https://harit.dev/9e069ff6c2ad42c5ad04aad8a3c4276c 404
396-a6d8ddb95dcbfea07e7b.js:1 2021-08-18T16:41:07.062Z [info] FeatureFlagTransactionQueue preferIndexedDB {}
app-dff7cb8e1a5ee8eaf52b.js:1 GET https://analytics.pgncs.harit.dev/analytics.js/v1/g1mMn2qquRcv7exBIVDivoKl9cOrdxLA/analytics.min.js net::ERR_NAME_NOT_RESOLVED
t.load @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
ee @ app-dff7cb8e1a5ee8eaf52b.js:1
Q @ app-dff7cb8e1a5ee8eaf52b.js:1
willMount @ app-dff7cb8e1a5ee8eaf52b.js:1
UNSAFE_componentWillMount @ app-dff7cb8e1a5ee8eaf52b.js:1
Za @ 396-a6d8ddb95dcbfea07e7b.js:1
lo @ 396-a6d8ddb95dcbfea07e7b.js:1
Ps @ 396-a6d8ddb95dcbfea07e7b.js:1
xs @ 396-a6d8ddb95dcbfea07e7b.js:1
ks @ 396-a6d8ddb95dcbfea07e7b.js:1
ms @ 396-a6d8ddb95dcbfea07e7b.js:1
Ks @ 396-a6d8ddb95dcbfea07e7b.js:1
Js @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
Ds @ 396-a6d8ddb95dcbfea07e7b.js:1
au @ 396-a6d8ddb95dcbfea07e7b.js:1
render @ 396-a6d8ddb95dcbfea07e7b.js:1
O @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
async function (async)
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
68530 @ app-dff7cb8e1a5ee8eaf52b.js:1
d @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
d.O @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
396-a6d8ddb95dcbfea07e7b.js:1 POST https://harit.dev/api/v3/getPublicPageData 500
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
c @ app-dff7cb8e1a5ee8eaf52b.js:1
Z @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
M @ app-dff7cb8e1a5ee8eaf52b.js:1
396-a6d8ddb95dcbfea07e7b.js:1 HttpRequestError: Something went wrong.
    at c (app-dff7cb8e1a5ee8eaf52b.js:1)
    at async Z (app-dff7cb8e1a5ee8eaf52b.js:1)
    at async Object.M (app-dff7cb8e1a5ee8eaf52b.js:1)
    at async Promise.all (index 0)
    at async Object.F (app-dff7cb8e1a5ee8eaf52b.js:1)
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
Z @ app-dff7cb8e1a5ee8eaf52b.js:1
async function (async)
Z @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
M @ app-dff7cb8e1a5ee8eaf52b.js:1
396-a6d8ddb95dcbfea07e7b.js:1 2021-08-18T16:41:07.257Z [error] main ClientError {error: {…}}
app-dff7cb8e1a5ee8eaf52b.js:1 Uncaught (in promise) HttpRequestError: Something went wrong.
    at c (app-dff7cb8e1a5ee8eaf52b.js:1)
    at async Z (app-dff7cb8e1a5ee8eaf52b.js:1)
    at async Object.M (app-dff7cb8e1a5ee8eaf52b.js:1)
    at async Promise.all (index 0)
    at async Object.F (app-dff7cb8e1a5ee8eaf52b.js:1)
d @ app-dff7cb8e1a5ee8eaf52b.js:1
c @ app-dff7cb8e1a5ee8eaf52b.js:1
async function (async)
F @ app-dff7cb8e1a5ee8eaf52b.js:1
_t @ app-dff7cb8e1a5ee8eaf52b.js:1
async function (async)
_t @ app-dff7cb8e1a5ee8eaf52b.js:1
Zt @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
async function (async)
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
68530 @ app-dff7cb8e1a5ee8eaf52b.js:1
d @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
d.O @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
(anonymous) @ app-dff7cb8e1a5ee8eaf52b.js:1
396-a6d8ddb95dcbfea07e7b.js:1 POST https://o324374.ingest.sentry.io/api/5741876/store/?sentry_key=704fe3b1898d4ccda1d05fe1ee79a1f7&sentry_version=7 403
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
e @ 396-a6d8ddb95dcbfea07e7b.js:1
t.sendEvent @ 396-a6d8ddb95dcbfea07e7b.js:1
e.sendEvent @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
onfulfilled @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
_executeHandlers @ 396-a6d8ddb95dcbfea07e7b.js:1
_attachHandler @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
e @ 396-a6d8ddb95dcbfea07e7b.js:1
e.then @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
e @ 396-a6d8ddb95dcbfea07e7b.js:1
e._processEvent @ 396-a6d8ddb95dcbfea07e7b.js:1
e.captureEvent @ 396-a6d8ddb95dcbfea07e7b.js:1
e._invokeClient @ 396-a6d8ddb95dcbfea07e7b.js:1
e.captureEvent @ 396-a6d8ddb95dcbfea07e7b.js:1
callback @ 396-a6d8ddb95dcbfea07e7b.js:1
$e @ 396-a6d8ddb95dcbfea07e7b.js:1
Ye.Se.onunhandledrejection @ 396-a6d8ddb95dcbfea07e7b.js:1
396-a6d8ddb95dcbfea07e7b.js:1 POST https://o324374.ingest.sentry.io/api/5741876/store/?sentry_key=704fe3b1898d4ccda1d05fe1ee79a1f7&sentry_version=7 403
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
e @ 396-a6d8ddb95dcbfea07e7b.js:1
t.sendEvent @ 396-a6d8ddb95dcbfea07e7b.js:1
e.sendEvent @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
onfulfilled @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
_executeHandlers @ 396-a6d8ddb95dcbfea07e7b.js:1
_attachHandler @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
e @ 396-a6d8ddb95dcbfea07e7b.js:1
e.then @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
e @ 396-a6d8ddb95dcbfea07e7b.js:1
e._processEvent @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
onfulfilled @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
_executeHandlers @ 396-a6d8ddb95dcbfea07e7b.js:1
_attachHandler @ 396-a6d8ddb95dcbfea07e7b.js:1
(anonymous) @ 396-a6d8ddb95dcbfea07e7b.js:1
e @ 396-a6d8ddb95dcbfea07e7b.js:1
e.then @ 396-a6d8ddb95dcbfea07e7b.js:1
e.captureException @ 396-a6d8ddb95dcbfea07e7b.js:1
e._invokeClient @ 396-a6d8ddb95dcbfea07e7b.js:1
e.captureException @ 396-a6d8ddb95dcbfea07e7b.js:1
o @ 396-a6d8ddb95dcbfea07e7b.js:1
s @ 396-a6d8ddb95dcbfea07e7b.js:1
a @ app-dff7cb8e1a5ee8eaf52b.js:1
l @ app-dff7cb8e1a5ee8eaf52b.js:1
async function (async)
l @ app-dff7cb8e1a5ee8eaf52b.js:1
r @ 396-a6d8ddb95dcbfea07e7b.js:1

@prodaea
Copy link

prodaea commented Aug 18, 2021

Yeah see #113 , that's a bit different than this one.

@Stonerkid
Copy link

Stonerkid commented Aug 23, 2021

Hi! I still find the "Mismatch between origin and baseUrl (dev)." message. I've tried all the solutions here including the new code but they're not working, it's so frustrating :(

Any thoughts?

@fastndcurious
Copy link

Hi there,

Fixed & working well for me.
The prob seems to come from the Fruition Code generation for the Cloudfare worker (step 3).

window.CONFIG.domainBaseUrl = "https://yourdomainname.com"; instead of
window.CONFIG.domainBaseUrl = 'https://${MY_DOMAIN}'

By the way my JS is a bit rusty. What is exactly the difference between
CONST = 'https://\${MY_DOMAIN}'
CONST = 'https://${MY_DOMAIN}

@stephenou maybe could you update this PR 8b1f7dc

Thanks,

@Stonerkid
Copy link

Sorry, I don't get it. Are you refering to the code at step 2? (the one with the "copy the code" button) Otherwise I don't understand what do you mean by step 3. Besides, I can't tell the difference between the new line you have written and the one given at Fruitonsite.

@Stonerkid
Copy link

According to the comments to this post [https://michaeljfordham.medium.com/how-and-why-im-using-notion-as-my-portfolio-c4eb927b613c], "It appears an update Notion rolled out last week has broken a lot of Fruition sites". Anyone else with the same problems? I have recently renewed my domain and other stuff and I'm afraid it's wasted money :( :( :(

@tamagamis
Copy link

I understand, currently my sites are operational.

@Stonerkid
Copy link

I understand, currently my sites are operational.

But did you have the same problem?

@fastndcurious
Copy link

Sorry, I don't get it. Are you refering to the code at step 2? (the one with the "copy the code" button) Otherwise I don't understand what do you mean by step 3. Besides, I can't tell the difference between the new line you have written and the one given at Fruitonsite.

Yes the Step 2 in Fruition when copying the code in the Worker into Cloudfare

@tarkolar
Copy link

tarkolar commented Sep 1, 2021

Hi,
I'm facing this issue since the beginning but no matter how much I tried, it still exists.
I tried:

  • Generating new code
  • Completely clearing caches from Cloudflare
  • Removing and re-adding my website on Cloudflare.
  • Checked each step mentioned here.

my website is onurolgun.com and notion link: https://forest-blob-004.notion.site/Merhaba-dd04482390504dfdbe8367ccb08a696f

Can anyone share any idea, please?

This code (new) does not work:
`
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 = '';
slugs.forEach(
(slug) =>
(sitemap +=
'https://' + MY_DOMAIN + '/' + slug + '')
);
sitemap += '';
return 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(<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;
}
element(element) {
element.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
});
}
}

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);
}`

@tamagamis
Copy link

tamagamis commented Sep 1, 2021

onurolgun.com

I understand your situation, I just tested this code with my workers and they work, you just have to edit the code.

imagen: https://ibb.co/khxwqVv

CODE FIX: https://gist.github.com/isjair/7f3f243d229de2873eb612129216288e

@tarkolar
Copy link

tarkolar commented Sep 1, 2021

I understand your situation, I just tested this code with my workers and they work, you just have to edit the code.
CODE FIX: https://gist.github.com/isjair/7f3f243d229de2873eb612129216288e

Thanks for your help. However, even though I copied the exact same code but only changed the domain and slug, and it still does not work.

Can you tell me that is there something I should do else, or change something from my domain provider, godaddY?

@tamagamis
Copy link

Entiendo tu situación, acabo de probar este código con mis trabajadores y ellos funcionan, solo tienes que editar el código. CORRECCIÓN DE CÓDIGO: https://gist.github.com/isjair/7f3f243d229de2873eb612129216288e

Gracias por su ayuda. Sin embargo, a pesar de que copié exactamente el mismo código, solo cambié el dominio y la, y todavía no funciona.

¿Puedes decirme que hay algo que debería hacer de otra manera, o cambiar algo de mi proveedor de dominio, godaddY?

If you verify your domain provider and that everything is fine since the error that I get is that you cannot access the same domain you have, now if you have it from cloudflare verify the dns and you have deleted the cache in development mode and Go into private mode in the browser and check if you have access, if you do not have access there is an error from the provider in some configuration.

Because if the domain will work, it will send you the page with a very common baseurl error, but since it is not, then it is assumed that it is from a provider to cloudflare or the other way around.
Greetings

@tarkolar
Copy link

tarkolar commented Sep 1, 2021

As far as I tried, I still get the same baseUrl error. It is frustrating actually.
I tried with my different domain in a different service provider but still the same issue. I am trying with a new Cloudflare account. I will share the results 👍

@tarkolar
Copy link

tarkolar commented Sep 1, 2021

I am trying with a new Cloudflare account. I will share the results 👍

Nope, new Cloudflare account also didn't work. I'm out of ideas it still does not work.

I know that worker starts. Because when I try to enter the site, it goes 404 but adds the Slug at the end of the URL. However, it does not work completely. I cannot understand it and I'm out of ideas. Please, I need further assistance 🙏 @isjair

@tamagamis
Copy link

I am trying with a new Cloudflare account. I will share the results 👍

Nope, new Cloudflare account also didn't work. I'm out of ideas it still does not work.

I know that worker starts. Because when I try to enter the site, it goes 404 but adds the Slug at the end of the URL. However, it does not work completely. I cannot understand it and I'm out of ideas. Please, I need further assistance 🙏 @isjair

I understand your situation and at the same time it is very strange, have you tried to generate new code? from this post?

https://www.reddit.com/r/Notion/comments/p495vu/fruitionsite_correction_active/?utm_medium=android_app&utm_source=share or https://fruition-git-fork-laughnan-override-domainbaseurl-stephenou.vercel.app/

copied as is in worker once I make it clear cache, development mode and wait and open in incognito mode, since it worked for me as I attached it previously is strange

@tarkolar
Copy link

tarkolar commented Sep 2, 2021

Hi again,
I still cannot make it work. I tried a new link again but it is still the same. Cleared the cache also. Do you know that do I need to any specific A or any other dns code for my Cloudflare account?
Btw, much appreciated for your help, thanks @isjair

@tamagamis
Copy link

SmartSelect_20210902-072635_Chrome
my dns configuration is not needed for more. so without www ai you do not have it configured at the time of registering the domain in cloudflare, the redirected to www will not let you place it. so try the domain without www.

Hola de nuevo,
todavía no puedo hacer que funcione. Intenté un nuevo enlace de nuevo, pero sigue siendo el mismo. También borró el caché. ¿Sabe que necesito algún código A específico o cualquier otro código dns para mi cuenta de Cloudflare?
Por cierto, muy apreciado por tu ayuda, gracias @isjair

@lkayy
Copy link

lkayy commented Sep 7, 2021

There seems to be reference to two different errors in this post. The "redirect" error that happened about a month ago and the more recent "Mismatch" error.

The "redirect" error was due to Notions update allowing users to set a public user name under account settings and if this was not completed by a certain date Notion would assign a temporary user name. If this has happened to you then you would have noticed a strange url on your public site.

To correct this you must first choose a public url for your workspace under your Notion settings. Then this must be updated in the cloudflare worker script ONLY if the change altered the plug. If it did not then the redirect should processed through cloudflare.

The "Mismatch" error can be corrected (as stated in a previous comment) by adding
window.CONFIG.domainBaseUrl = "https://yourdomainname.com";

I have seen several posts on Reddit that this is to be added to line 4, however it depends on the script your are using. If you are using the original (or close to original) Fruition script, then the line will be added closer to the bottom (under "element. append"). Be sure to replace the "yourdomainname" with your custom domain. Save, deploy and exit worker.

I hope this helps

@beatrixcendana
Copy link

Thanks to Ryo from Notion, my site is working now:
https://startup.wentin.net/
This is how to fix it
my old code on Cloudflare:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

my new code:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      window.CONFIG.domainBaseUrl = "https://startup.wentin.net";
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

the line I added that fixed the issue

  window.CONFIG.domainBaseUrl = "https://startup.wentin.net";

how to found this code? what file should i open?

Click Worker - Manage Workers - Choose the workers that you made before - Quick Edit
Check this link, read Create a script for Cloudflare Worker. They have more explanations of how to do it.

@Stonerkid
Copy link

Stonerkid commented Sep 19, 2021

Thanks to Ryo from Notion, my site is working now:
https://startup.wentin.net/
This is how to fix it
my old code on Cloudflare:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

my new code:

  class BodyRewriter {
    constructor(SLUG_TO_PAGE) {
      this.SLUG_TO_PAGE = SLUG_TO_PAGE;
    }
    element(element) {
      element.append(`<div style="display:none">Powered by <a href="http://fruitionsite.com">Fruition</a></div>
      <script>
      window.CONFIG.domainBaseUrl = "https://startup.wentin.net";
      const SLUG_TO_PAGE = ${JSON.stringify(this.SLUG_TO_PAGE)};
      ...

the line I added that fixed the issue

  window.CONFIG.domainBaseUrl = "https://startup.wentin.net";

how to found this code? what file should i open?

Click Worker - Manage Workers - Choose the workers that you made before - Quick Edit
Check this link, read Create a script for Cloudflare Worker. They have more explanations of how to do it.

Nothing, this code neither works for me. Guess I'll have to check something different from Fruition.

@harryghgim
Copy link

Entiendo tu situación, acabo de probar este código con mis trabajadores y ellos funcionan, solo tienes que editar el código. CORRECCIÓN DE CÓDIGO: https://gist.github.com/isjair/7f3f243d229de2873eb612129216288e

Gracias por su ayuda. Sin embargo, a pesar de que copié exactamente el mismo código, solo cambié el dominio y la, y todavía no funciona.
¿Puedes decirme que hay algo que debería hacer de otra manera, o cambiar algo de mi proveedor de dominio, godaddY?

If you verify your domain provider and that everything is fine since the error that I get is that you cannot access the same domain you have, now if you have it from cloudflare verify the dns and you have deleted the cache in development mode and Go into private mode in the browser and check if you have access, if you do not have access there is an error from the provider in some configuration.

Because if the domain will work, it will send you the page with a very common baseurl error, but since it is not, then it is assumed that it is from a provider to cloudflare or the other way around. Greetings

Thanks. Using a different brower than the one I used before I changed config, incognito mode or safari instead of chrome, worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests