Skip to content

Commit d65a0bb

Browse files
authored
Merge pull request #8 from bitrise-io/update-worker-origin-host
update worker origins
2 parents 039f752 + 3d51622 commit d65a0bb

7 files changed

Lines changed: 17 additions & 7 deletions

File tree

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const importedWorkers = {};
2323
async function importWorker(workerName, workerPath) {
2424
const workerContent = (await fs.promises.readFile(workerPath, 'utf8'))
2525
.toString()
26-
.replaceAll('webflow.bitrise.io', webflowDomain)
26+
.replaceAll("ORIGIN_HOST = 'bitrise.io'", `ORIGIN_HOST = '${webflowDomain}'`)
2727
.replaceAll(
2828
`urlObject.hostname = 'web-cdn.bitrise.io';`,
2929
`urlObject.hostname = '${hostname}'; urlObject.port = ${port}; urlObject.search = 'cdn=1';`, // TODO: make this switchable

src/js/bitrise-navigation/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const fs = require('fs');
22
const { JSDOM } = require('jsdom');
33

44
const FETCH_TIMEOUT_MS = 30000;
5-
const SOURCE_URL = 'https://webflow.bitrise.io/';
5+
const SOURCE_URL = 'https://bitrise.io/';
66

77
// Selectors & patterns — centralised so they're easy to update when Webflow changes.
88
const VERSION = 'v2';

src/js/career-maps/worker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ async function addCorsHeaders(originalResponse) {
1818
return response;
1919
}
2020

21+
const ORIGIN_HOST = 'bitrise.io';
22+
2123
addEventListener('fetch', (event) => {
2224
const urlObject = new URL(event.request.url);
2325
let useCors = true;
2426

25-
urlObject.hostname = 'webflow.bitrise.io';
27+
urlObject.hostname = ORIGIN_HOST;
2628

2729
if (urlObject.pathname.match(/^\/careers\/maps\/data\.json$/)) {
2830
urlObject.hostname = 'web-cdn.bitrise.io';

src/js/changelog/worker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
const ORIGIN_HOST = 'bitrise.io';
2+
13
export default {
24
async fetch(request) {
35
const urlObject = new URL(request.url);
46

57
let useCors = false;
68
let transformBody = null;
7-
urlObject.hostname = 'webflow.bitrise.io';
9+
urlObject.hostname = ORIGIN_HOST;
810

911
if (urlObject.pathname.match(/^\/changelog\/api\/(.+\.json)$/)) {
1012
urlObject.hostname = 'discuss.bitrise.io';

src/js/integrations/worker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
const ORIGIN_HOST = 'bitrise.io';
2+
13
export default {
24
async fetch(request) {
35
const urlObject = new URL(request.url);
46
const canonical = new URL(request.url);
57

6-
urlObject.hostname = 'webflow.bitrise.io';
8+
urlObject.hostname = ORIGIN_HOST;
79
canonical.hostname = 'bitrise.io';
810

911
if (urlObject.pathname.match(/^\/integrations\/steps\/.+/)) {

src/js/pricing/worker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
const ORIGIN_HOST = 'bitrise.io';
2+
13
export default {
24
async fetch(request) {
35
const urlObject = new URL(request.url);
46

5-
urlObject.hostname = 'webflow.bitrise.io';
7+
urlObject.hostname = ORIGIN_HOST;
68

79
const actualPath = 'plans-pricing';
810
const variantPath = 'plans-pricing-pro-plan-variant';

src/js/stacks/worker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
const ORIGIN_HOST = 'bitrise.io';
2+
13
export default {
24
async fetch(request) {
35
const urlObject = new URL(request.url);
46

5-
urlObject.hostname = 'webflow.bitrise.io';
7+
urlObject.hostname = ORIGIN_HOST;
68

79
const rssMatch = urlObject.pathname.match(/^\/stacks\/(.*index\.xml)/);
810
if (rssMatch) {

0 commit comments

Comments
 (0)