workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

๐Ÿš€ Feature Request: Add support for custom local hostnames

Open Hexstream opened this issue 3 years ago โ€ข 23 comments

Describe the solution

Hello,

I am managing 25+ subdomains.

Right now, if I start multiple instances of wrangler pages dev (on multiple ports), I get URLs like:

https://127.0.0.1:8788/
https://127.0.0.1:8789/
https://127.0.0.1:8790/

I would much rather use URLs like:

https://dev.www.hexstreamsoft.com:8788/
https://dev.clos-mop.hexstreamsoft.com:8789/
https://dev.notes-and-tips.hexstreamsoft.com:8790/

So for instance, I added a mapping from dev.www.hexstreamsoft.com to 127.0.0.1 in my /etc/hosts/ file.

However, after starting wrangler pages dev public --local-protocol https and successfully opening https://127.0.0.1:8788/, https://dev.www.hexstreamsoft.com:8788/ does not work:

custom-local-hostname-https.png

(Plain HTTP is irrelevant for my use-case, since all my websites are HTTPS-only with full HSTS enabled (so it's impossible to access dev.www.hexstreamsoft.com over plain HTTP anyway), and many modern features are HTTPS-only.)

So, it would be really nice if I could use something like this: wrangler pages dev public --local-protocol https --hostname dev.www.hexstreamsoft.com

Hexstream avatar Oct 08 '22 12:10 Hexstream

Thanks for bringing this up! We've added it to our issue backlog :)

caass avatar Oct 10 '22 15:10 caass

Thank you!! This will be a tremendous boon for usability!!

Hexstream avatar Oct 10 '22 17:10 Hexstream

FWIW:

I do that on miniflare 2 + worker sites; I have one of my domains with a DNS pointing to 127.0.0.1, and a wildcard DNS point to the root. My worker will receive all requests and handle appropriate for each subdomain. I cant do the same on wrangler2, then i still need to use miniflare for that.

Thats is also why i still use worker sites, because i can do much more.

Will be nice to be able to setup a base hostname, and still accept any subdomain request like we do on miniflare today.

Wallacy avatar Feb 25 '23 00:02 Wallacy

I am able to use Cloudflare Tunnels for this and it works great for the most part. However, there is still an issue of live-reload websocket server pointing to the custom hostname URL (the local development websocket server isn't running on that hostname). If there was a way to set the URL for the local websocket dev server it should solve this problem completely.

shripadk avatar Apr 26 '23 13:04 shripadk

hi folks,

looking at the original report, I'm seeing the page is blocked on NET::ERR_CERT_AUTHORITY_INVALID, so I'm wondering if the issues y'all are experiencing are not security certificates related. Back when this issue was raised, wrangler only supported self-signed certificates. That changed however with the landing of https://github.com/cloudflare/workers-sdk/pull/4475. You can now pass the --https-key-path and --https-cert-path to your pages dev command to use your own ssl certificates.

Would be good to confirm whether that fixes the issue for you

CarmenPopoviciu avatar Jun 27 '24 10:06 CarmenPopoviciu

Thank you, I want to try this solution, unfortunately I am not yet familiar with manually generating local development certificates, so I have some reading to do. Ideally, I would want just one long-lived certificate for all my local dev.* domain names that I would declare in my hosts file.

I have started looking at mkcert, and am open to other suggestions.

(Maybe wrangler could provide or document an easy way to generate such local development certificates?)

Hexstream avatar Jun 27 '24 22:06 Hexstream

I am not very familiar with generating ssl certificates for local dev either, but mkcert seems like a good place to start (also see https://web.dev/articles/how-to-use-local-https).

I need to inquire on whether we have an official recommendation for such a tool, but if we do, we can definitely add that to our docs (great idea!). I'll circle back here once I know more

CarmenPopoviciu avatar Jun 28 '24 13:06 CarmenPopoviciu

I can confirm that mkcert is indeed a good option. I'll look into whether I can open a PR to our docs. In the meanwhile, please keep us posted if using the custom certificate solved your issue <3

CarmenPopoviciu avatar Jun 28 '24 14:06 CarmenPopoviciu

Great! Thank you for the pointers.

I'm on it!

Hexstream avatar Jun 28 '24 14:06 Hexstream

@Hexstream - could I ask if there is a specific reason why you want to turn on --local-protocol=https in your local development?

petebacondarwin avatar Jun 28 '24 15:06 petebacondarwin

@CarmenPopoviciu Great news! mkcert is 100% painless, and I quickly got the results I want in every way, except for one critical usability issue:

Pressing b in wrangler opens for instance https://localhost:8800/ instead of https://dev.abc.hexstream.xyz:8800/.

So I just need a way to pass --hostname dev.abc.hexstream.xyz or similar to wrangler.


So here is what I did, it's quite trivial.

  • I added the 32 dev domain names as an alias for 127.0.0.1 to my /etc/hosts file.

  • For installing mkcert, libnss3-tools was already installed, so I just installed the pre-built binaries.

  • I invoked mkcert -install to install the CA.

  • I generated my certificate for my 32 dev domains with mkcert [32 domains like dev.abc.hexstream.xyz] while in /home/hexstream/apps/mkcert/, then renamed the files to key.pem and cert.pem. (I could have used the -key-file and -cert-file options instead.)

  • I edited my usual wrangler invocations to look like this: wrangler pages dev public --local-protocol https --port 8800 --https-key-path /home/hexstream/apps/mkcert/key.pem --https-cert-path /home/hexstream/apps/mkcert/cert.pem

  • I started wrangler pages dev per above, then pressed b and then edited the URL to be https://dev.abc.hexstream.xyz:8800/ instead of https://localhost:8800/ and pressed Enter.

That's all! Now we just need to eliminate the "edit the URL" part and we're golden!


@petebacondarwin Yes, there are various limitations in using http:localhost as a secure context, which I just don't want to deal with. I'm sure you appreciate the convenience of the development environment being nearly identical to production wherever possible...

Anyway I really want to use nice dev hostnames like dev.abc.hexstream.xyz, and I use HSTS everywhere, so HTTPS is inherently required. HTTP is just not accessible.

We're already almost there anyway, I just need the --hostname feature requested above and we're done!

Hexstream avatar Jun 28 '24 17:06 Hexstream

I think what we need here is for pages dev to support the --ip flag just like wrangler dev (see https://developers.cloudflare.com/workers/wrangler/commands/#dev). This should be fairly straightforward to add

CarmenPopoviciu avatar Jul 01 '24 12:07 CarmenPopoviciu

oh, actually ignore that last bit in my comment. pages dev already supports the --ip flag. @Hexstream can you please give that a try and let me know if that solved your issue?

CarmenPopoviciu avatar Jul 01 '24 12:07 CarmenPopoviciu

Unfortunately, --ip dev.abc.hexstream.xyz does not work, I thought it would since in the console it says [wrangler:inf] Ready on https://dev.abc.hexstream.xyz:8800, but pressing b mysteriously opens https://127.0.0.1:36323/, which of course doesn't work.

Manually fixing this to https://dev.abc.hexstream.xyz:8800/ works.

(Also, --ip sounds like a bit of a misnomer in this case, I think --hostname (or --host?) would be a bit better...)

Hexstream avatar Jul 01 '24 13:07 Hexstream

that's weird. I'm running wrangler pages dev [directory] --ip dev.carmen.test and pressing b does take me to that url. Are you seeing any other logs that might be helpful?

CarmenPopoviciu avatar Jul 01 '24 14:07 CarmenPopoviciu

(Also, --ip sounds like a bit of a misnomer in this case, I think --hostname (or --host?) would be a bit better...)

As an aside here, the various ip, host, hostname, upstream, etc names here are really confusing, since there are a number of concepts that need to be managed. In Workers generally, the hostname type terminology is the host where the Worker being debugged "believes" it is being hosted. In other words, this is the host on the request object passed to the Worker. This is significant when Workers are being used as middleware/proxies in front of an origin server, since calling fetch with the Worker's hostname will make a request to the origin not to the Worker.

petebacondarwin avatar Jul 01 '24 14:07 petebacondarwin

@CarmenPopoviciu Here is the log for wrangler pages dev public --local-protocol https --ip dev.abc.hexstream.xyz --https-key-path /home/hexstream/apps/mkcert/key.pem --https-cert-path /home/hexstream/apps/mkcert/cert.pem --log-level debug, unfortunately it's not quite as useful as I anticipated, it doesn't even mention dev.abc.hexstream.xyz (nor the command line), and --log-level debug does almost nothing more compared to omitting that argument...


--- 2024-07-01T15:01:04.004Z debug
๐Ÿชต  Writing logs to "/home/hexstream/.wrangler/logs/wrangler-2024-07-01_15-01-03_866.log"
---

--- 2024-07-01T15:01:04.004Z debug
Failed to load .env file ".env": Error: ENOENT: no such file or directory, open '.env'
    at Object.openSync (node:fs:582:18)
    at Object.readFileSync (node:fs:461:35)
    at tryLoadDotEnv (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:158768:72)
    at loadDotEnv (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:158777:12)
    at /home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:202740:20
    at /home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:162911:16
    at maybeAsyncResult (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:161132:44)
    at /home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:162910:14
    at /home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:161119:22
    at Array.reduce (<anonymous>) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '.env'
}
---

--- 2024-07-01T15:01:04.016Z log

 โ›…๏ธ wrangler 3.62.0
[38;2;255;136;0m-------------------[39m

---

--- 2024-07-01T15:01:04.057Z warn
[33mโ–ฒ [43;33m[[43;30mWARNING[43;33m][0m [1mNo compatibility_date was specified. Using today's date: 2024-07-01.[0m

  โฏโฏ Add one to your wrangler.toml file: compatibility_date = "2024-07-01", or
  โฏโฏ Pass it in your terminal: wrangler pages dev [<DIRECTORY>] --compatibility-date=2024-07-01
  
  See [4mhttps://developers.cloudflare.com/workers/platform/compatibility-dates/[0m for more information.


---

--- 2024-07-01T15:01:04.058Z log
No functions. Shimming...
---

--- 2024-07-01T15:01:04.072Z debug
Retrieving cached values for userId from node_modules/.cache/wrangler
---

--- 2024-07-01T15:01:04.072Z debug
Metrics dispatcher: Posting data {"type":"event","name":"run dev","properties":{"local":true,"usesTypeScript":true}}
---

--- 2024-07-01T15:01:04.080Z debug
Failed to load .env file "/home/hexstream/data/projects/websites/hexstream.xyz/abc.hexstream.xyz/.dev.vars": Error: ENOENT: no such file or directory, open '/home/hexstream/data/projects/websites/hexstream.xyz/abc.hexstream.xyz/.dev.vars'
    at Object.openSync (node:fs:582:18)
    at Object.readFileSync (node:fs:461:35)
    at tryLoadDotEnv (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:158768:72)
    at loadDotEnv (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:158777:12)
    at getVarsForDev (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:200152:18)
    at getBindings (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:207740:10)
    at getBindingsAndAssetPaths (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:207621:20)
    at getDevReactElement (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:207276:40)
    at startDev (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:207343:60)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/hexstream/data/projects/websites/hexstream.xyz/abc.hexstream.xyz/.dev.vars'
}
---

--- 2024-07-01T15:01:04.139Z log
Using custom certificate at  /home/hexstream/apps/mkcert/key.pem
---

--- 2024-07-01T15:01:04.205Z log
[2mโŽ” Starting local server...[22m
---

--- 2024-07-01T15:01:04.392Z log
โœจ Parsed 2 valid header rules.
---

--- 2024-07-01T15:01:04.417Z debug
[InspectorProxyWorker] handleProxyControllerIncomingMessage {"type":"reloadStart"}
---

--- 2024-07-01T15:01:04.538Z error
[31mโœ˜ [41;31m[[41;97mERROR[41;31m][0m [1mworkerd/server/server.c++:3448: info: Inspector is listening[0m


---

--- 2024-07-01T15:01:04.542Z debug
Metrics dispatcher: Posting data {"type":"event","name":"run pages dev","properties":{}}
---

--- 2024-07-01T15:01:04.551Z debug
[InspectorProxyWorker] handleProxyControllerIncomingMessage {"type":"reloadComplete","proxyData":{"userWorkerUrl":{"protocol":"http:","hostname":"127.0.0.1","port":"35673"},"userWorkerInspectorUrl":{"protocol":"ws:","hostname":"127.0.0.1","port":"39739","pathname":"/core:user:worker"},"userWorkerInnerUrlOverrides":{"protocol":"https"},"headers":{"MF-Proxy-Shared-Secret":"1191d008-224e-4d8f-b909-c6ebabe39be1"},"liveReload":false,"proxyLogsToController":false,"internalDurableObjects":[],"entrypointAddresses":{"__INTERNAL_WRANGLER_MIDDLEWARE__":{"host":"127.0.0.1","port":44795},"default":{"host":"127.0.0.1","port":45355}}}}
---

--- 2024-07-01T15:01:04.554Z debug
[InspectorProxyWorker] reconnectRuntimeWebSocket
---

--- 2024-07-01T15:01:04.557Z error
[31mโœ˜ [41;31m[[41;97mERROR[41;31m][0m [1mworkerd/server/server.c++:1220: info: Inspector client attaching [core:user:worker][0m


---

--- 2024-07-01T15:01:04.561Z debug
[InspectorProxyWorker] NEW RUNTIME WEBSOCKET http://127.0.0.1:39739/core:user:worker
---

--- 2024-07-01T15:01:04.564Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE {
  method: 'Runtime.executionContextCreated',
  params: {
    context: {
      id: 355797089,
      origin: '',
      name: 'Worker',
      uniqueId: '-8642599922537279942.-7841921188685164253'
    }
  }
}
---

--- 2024-07-01T15:01:04.567Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000001, result: {} }
---

--- 2024-07-01T15:01:04.569Z debug
[InspectorProxyWorker] SEND TO DEVTOOLS {"method":"Runtime.executionContextsCleared"}
---

--- 2024-07-01T15:01:04.572Z debug
[InspectorProxyWorker] RUNTIME WEBSOCKET OPENED
---

--- 2024-07-01T15:01:04.575Z debug
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.enable","id":100000001}
---

--- 2024-07-01T15:01:04.578Z debug
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Debugger.enable","id":100000002}
---

--- 2024-07-01T15:01:04.581Z debug
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Network.enable","id":100000003}
---

--- 2024-07-01T15:01:04.584Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE {
  method: 'Debugger.scriptParsed',
  params: {
    scriptId: '3',
    url: 'file:///home/hexstream/data/projects/websites/hexstream.xyz/abc.hexstream.xyz/.wrangler/tmp/dev-dBNgnA/pages-shim.js',
    startLine: 0,
    startColumn: 0,
    endLine: 199,
    endColumn: 130,
    executionContextId: 355797089,
    hash: '92fae1739b2628f1a1b651d529400fa86ff59080aa6409fdae0f90ebe0906111',
    isLiveEdit: false,
    sourceMapURL: 'pages-shim.js.map',
    hasSourceURL: true,
    isModule: true,
    length: 6573,
    scriptLanguage: 'JavaScript',
    embedderName: 'pages-shim.js'
  }
}
---

--- 2024-07-01T15:01:04.585Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE {
  id: 100000002,
  result: { debuggerId: '6854278076421548368.-8686340897058967431' }
}
---

--- 2024-07-01T15:01:04.587Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000003, method: 'Network.enable', result: {} }
---

--- 2024-07-01T15:01:14.552Z debug
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000004}
---

--- 2024-07-01T15:01:14.557Z debug
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000004, result: { id: '56b98f376911ea16' } }
---

edit: And here is my terminal, after pressing b:

hexstream@dynamorph:~/data/projects/websites/hexstream.xyz/abc.hexstream.xyz$ wrangler pages dev public --local-protocol https --ip dev.abc.hexstream.xyz --https-key-path /home/hexstream/apps/mkcert/key.pem --https-cert-path /home/hexstream/apps/mkcert/cert.pem --log-level debug
๐Ÿชต  Writing logs to "/home/hexstream/.wrangler/logs/wrangler-2024-07-01_15-24-07_508.log"
Failed to load .env file ".env": Error: ENOENT: no such file or directory, open '.env'
    at Object.openSync (node:fs:582:18)
    at Object.readFileSync (node:fs:461:35)
    at tryLoadDotEnv (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:158768:72)
    at loadDotEnv (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:158777:12)
    at /home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:202740:20
    at /home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:162911:16
    at maybeAsyncResult (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:161132:44)
    at /home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:162910:14
    at /home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:161119:22
    at Array.reduce (<anonymous>) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '.env'
}

 โ›…๏ธ wrangler 3.62.0
-------------------

โ–ฒ [WARNING] No compatibility_date was specified. Using today's date: 2024-07-01.

  โฏโฏ Add one to your wrangler.toml file: compatibility_date = "2024-07-01", or
  โฏโฏ Pass it in your terminal: wrangler pages dev [<DIRECTORY>] --compatibility-date=2024-07-01
  
  See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for more information.


No functions. Shimming...
Retrieving cached values for userId from node_modules/.cache/wrangler
Metrics dispatcher: Posting data {"type":"event","name":"run dev","properties":{"local":true,"usesTypeScript":true}}
Failed to load .env file "/home/hexstream/data/projects/websites/hexstream.xyz/abc.hexstream.xyz/.dev.vars": Error: ENOENT: no such file or directory, open '/home/hexstream/data/projects/websites/hexstream.xyz/abc.hexstream.xyz/.dev.vars'
    at Object.openSync (node:fs:582:18)
    at Object.readFileSync (node:fs:461:35)
    at tryLoadDotEnv (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:158768:72)
    at loadDotEnv (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:158777:12)
    at getVarsForDev (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:200152:18)
    at getBindings (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:207740:10)
    at getBindingsAndAssetPaths (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:207621:20)
    at getDevReactElement (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:207276:40)
    at startDev (/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:207343:60)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/hexstream/data/projects/websites/hexstream.xyz/abc.hexstream.xyz/.dev.vars'
}
Using custom certificate at  /home/hexstream/apps/mkcert/key.pem
โŽ” Starting local server...
[wrangler-ProxyWorker:inf] Ready on https://dev.abc.hexstream.xyz:8788
โœจ Parsed 2 valid header rules.
[wrangler-ProxyWorker:inf] GET /cdn-cgi/ProxyWorker/pause 204 No Content (3ms)
[InspectorProxyWorker] handleProxyControllerIncomingMessage {"type":"reloadStart"}
[wrangler-ProxyWorker:inf] GET /cdn-cgi/ProxyWorker/pause 204 No Content (1ms)
[wrangler-ProxyWorker:inf] GET /cdn-cgi/ProxyWorker/pause 204 No Content (1ms)
โœ˜ [ERROR] workerd/server/server.c++:3448: info: Inspector is listening


Metrics dispatcher: Posting data {"type":"event","name":"run pages dev","properties":{}}
[InspectorProxyWorker] handleProxyControllerIncomingMessage {"type":"reloadComplete","proxyData":{"userWorkerUrl":{"protocol":"http:","hostname":"127.0.0.1","port":"36203"},"userWorkerInspectorUrl":{"protocol":"ws:","hostname":"127.0.0.1","port":"42659","pathname":"/core:user:worker"},"userWorkerInnerUrlOverrides":{"protocol":"https"},"headers":{"MF-Proxy-Shared-Secret":"ecf0e0c7-51a7-4515-8c2e-af4442db8b99"},"liveReload":false,"proxyLogsToController":false,"internalDurableObjects":[],"entrypointAddresses":{"__INTERNAL_WRANGLER_MIDDLEWARE__":{"host":"127.0.0.1","port":44863},"default":{"host":"127.0.0.1","port":46429}}}}
[InspectorProxyWorker] reconnectRuntimeWebSocket
โœ˜ [ERROR] workerd/server/server.c++:1220: info: Inspector client attaching [core:user:worker]


[InspectorProxyWorker] NEW RUNTIME WEBSOCKET http://127.0.0.1:42659/core:user:worker
[InspectorProxyWorker] SEND TO DEVTOOLS {"method":"Runtime.executionContextsCleared"}
[InspectorProxyWorker] RUNTIME WEBSOCKET OPENED
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.enable","id":100000001}
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Debugger.enable","id":100000002}
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Network.enable","id":100000003}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE {
  method: 'Runtime.executionContextCreated',
  params: {
    context: {
      id: 152036577,
      origin: '',
      name: 'Worker',
      uniqueId: '-41477350508035698.-4696686971395084048'
    }
  }
}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000001, result: {} }
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE {
  method: 'Debugger.scriptParsed',
  params: {
    scriptId: '3',
    url: 'file:///home/hexstream/data/projects/websites/hexstream.xyz/abc.hexstream.xyz/.wrangler/tmp/dev-cVWVyq/pages-shim.js',
    startLine: 0,
    startColumn: 0,
    endLine: 199,
    endColumn: 130,
    executionContextId: 152036577,
    hash: '6c476005c20d497b36a97451b39cd4f394dc84bb6ade75c28a03703c801c4d46',
    isLiveEdit: false,
    sourceMapURL: 'pages-shim.js.map',
    hasSourceURL: true,
    isModule: true,
    length: 6573,
    scriptLanguage: 'JavaScript',
    embedderName: 'pages-shim.js'
  }
}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE {
  id: 100000002,
  result: { debuggerId: '5623933516383853133.8160851138706160102' }
}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000003, method: 'Network.enable', result: {} }
[wrangler-ProxyWorker:inf] GET /cdn-cgi/ProxyWorker/play 204 No Content (1ms)
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000004}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000004, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000005}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000005, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000006}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000006, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000007}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000007, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000008}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000008, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000009}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000009, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000010}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000010, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000011}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000011, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000012}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000012, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000013}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000013, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000014}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000014, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000015}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000015, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000016}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000016, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000017}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000017, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000018}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000018, result: { id: '70fba4575ce21ca6' } }
[InspectorProxyWorker] SEND TO RUNTIME {"method":"Runtime.getIsolateId","id":100000019}
[InspectorProxyWorker] RUNTIME INCOMING MESSAGE { id: 100000019, result: { id: '70fba4575ce21ca6' } }
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit                                                                                      โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

edit 2: I forgot the --port option in the terminal, but it substantially doesn't change anything.

Hexstream avatar Jul 01 '24 15:07 Hexstream

(Edited twice above to include more details...)

Hexstream avatar Jul 01 '24 15:07 Hexstream

One thing I notice is that if pressing b opens a wrong url like https://127.0.0.1:43111/, then editing it to http://127.0.0.1:43111/ (removing the s) does work, which is baffling since I specified --local-protocol https --port 8800.

(I had sometimes forgotten the --port option above, but it substantially doesn't change anything.)

Hexstream avatar Jul 01 '24 15:07 Hexstream

I'll need to debug this a bit and understand why this is happening. pages dev definitely takes in those args correctly, so I think the problem is somewhere further down the line

CarmenPopoviciu avatar Jul 01 '24 16:07 CarmenPopoviciu

just out of curiosity...how does smth like wrangler pages dev [directory] --ip dev.Hexstream.abc --local-protocol https behave like for you if you press b? So basically using some random hostname instead of dev.abc.hexstream.xyz

CarmenPopoviciu avatar Jul 01 '24 17:07 CarmenPopoviciu

Here is my console, let me know if you want more debug details:

hexstream@dynamorph:~/data/projects/websites/hexstream.xyz/abc.hexstream.xyz$ wrangler pages dev public --ip dev.Hexstream.abc --local-protocol https

 โ›…๏ธ  wrangler 3.62.0
-------------------

โ–ฒ [WARNING] No compatibility_date was specified. Using today's date: 2024-07-01.

  โฏโฏ Add one to your wrangler.toml file: compatibility_date = "2024-07-01", or
  โฏโฏ Pass it in your terminal: wrangler pages dev [<DIRECTORY>] --compatibility-date=2024-07-01
  
  See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for more information.


No functions. Shimming...
โŽ” Starting local server...
โœจ Parsed 2 valid header rules.
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit                                                                                      โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
/home/hexstream/.volta/tools/image/packages/wrangler/lib/node_modules/wrangler/wrangler-dist/cli.js:29747
            throw a;
            ^

Error: getaddrinfo ENOTFOUND dev.Hexstream.abc
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)
    at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17)
Emitted 'error' event on Server instance at:
    at GetAddrInfoReqWrap.doListen [as callback] (node:net:2106:12)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:17)
    at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'dev.Hexstream.abc'
}

Node.js v20.12.2

Hexstream avatar Jul 01 '24 18:07 Hexstream

nope, that's what I was looking for. thank you ๐Ÿ™

CarmenPopoviciu avatar Jul 01 '24 18:07 CarmenPopoviciu