This is an example call of @stevekrouse/insecureFetch
Cloudflare workers doesn't validate https certs???
Apparently not!
I assume it supports only GET requests?
I think it's a pretty naive proxy that supports anything, why do you ask, @vladimyr?
I didn't have any particular use case in mind just curious to know what to write next to it in my notes :)
And to answer my question, no POST requests aren't supported:
$ curl -s 'https://pie.dev/post' -F'foo=bar' # works $ curl -s 'https://unsecure-fetch.val-town.workers.dev?url=https://pie.dev/post' -F'foo=bar' # returns 405 Method Not Allowed
Also, keep in mind that you need to URL encode url param:
url
$ curl -s 'https://unsecure-fetch.val-town.workers.dev?url=https://pie.dev/get?foo=bar&baz=42' | jq -c '.args' # ==> {"foo":"bar"} $ curl -s 'https://unsecure-fetch.val-town.workers.dev?url=https%3A%2F%2Fpie.dev%2Fget%3Ffoo%3Dbar%26baz%3D42' | jq -c '.args' # ==> {"baz":"42","foo":"bar"}
In @stevekrouse's example: https://unsecure-fetch.val-town.workers.dev?url=https://assignment-api.uspto.gov/patent/basicSearch?query=1234567&fields=main&rows=20 query is consumed by proxied URL but fieldsand rows get consumed by proxy instead ⚠️
https://unsecure-fetch.val-town.workers.dev?url=https://assignment-api.uspto.gov/patent/basicSearch?query=1234567&fields=main&rows=20
query
fields
rows
It should now support POST requests and everything else – it forwards the whole req with the url changed.
I also made a helper method: @stevekrouse/insecureFetch
And include the source on the fetch's homepage: https://unsecure-fetch.val-town.workers.dev/
Oh, this is great! ❤️
I couldn't resist so I forked it and made it conform to the standard fetch signature allowing to easily switch between platform native, @std/fetch and @stevekrouse/insecureFetch as seen here: https://www.val.town/v/vladimyr/fetch_impl_examples
fetch
On a seemingly related note, the way you served source code reminded me of https://ghuc.cc/worker-tools/ghuc.cc/index.js
https://esm.town/v/stevekrouse/insecureSSLCertExample
<script type="module" src="https://esm.town/v/stevekrouse/insecureSSLCertExample"></script>
Cloudflare workers doesn't validate https certs???
Apparently not!
I assume it supports only GET requests?
I think it's a pretty naive proxy that supports anything, why do you ask, @vladimyr?
I didn't have any particular use case in mind just curious to know what to write next to it in my notes :)
And to answer my question, no POST requests aren't supported:
Also, keep in mind that you need to URL encode
url
param:In @stevekrouse's example:
https://unsecure-fetch.val-town.workers.dev?url=https://assignment-api.uspto.gov/patent/basicSearch?query=1234567&fields=main&rows=20
query
is consumed by proxied URL butfields
androws
get consumed by proxy instead ⚠️It should now support POST requests and everything else – it forwards the whole req with the url changed.
I also made a helper method: @stevekrouse/insecureFetch
And include the source on the fetch's homepage: https://unsecure-fetch.val-town.workers.dev/
Oh, this is great! ❤️
I couldn't resist so I forked it and made it conform to the standard
fetch
signature allowing to easily switch between platform native, @std/fetch and @stevekrouse/insecureFetch as seen here: https://www.val.town/v/vladimyr/fetch_impl_examplesOn a seemingly related note, the way you served source code reminded me of https://ghuc.cc/worker-tools/ghuc.cc/index.js