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

Return 500 error by cURL #484

Closed
junish opened this issue Jan 4, 2023 · 2 comments
Closed

Return 500 error by cURL #484

junish opened this issue Jan 4, 2023 · 2 comments
Labels
browser Not working in Browser

Comments

@junish
Copy link

junish commented Jan 4, 2023

Hi @ije. First of all, thank you so much. We are developing with esm.sh because it is very useful.

Now, we tried using esm.sh by curl. However, the response is 500 error:

❯ curl -I https://esm.sh/[email protected]

HTTP/2 500
date: Wed, 04 Jan 2023 14:31:13 GMT
content-type: text/html; charset=UTF-8
x-frame-options: SAMEORIGIN
referrer-policy: same-origin
cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
expires: Thu, 01 Jan 1970 00:00:01 GMT
cf-ray: 7844ad33be79df5c-NRT
server: cloudflare

But, when target query or User-Agent header is added, the response returns 200 status:

❯ curl -I 'https://esm.sh/[email protected]?target=esnext'

HTTP/2 200
date: Wed, 04 Jan 2023 14:31:46 GMT
content-type: application/javascript; charset=utf-8
content-length: 97
cf-ray: 7844adfeeb92af2b-NRT
cache-control: public, max-age=86400
vary: Origin
cf-cache-status: DYNAMIC
x-typescript-types: https://esm.sh/v102/[email protected]/types/runtime/index.d.ts
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=HMCXn3lE4GGmvCWNUK5tONV2aa7H04rom4qQYqktyhLTSjnT7mv3WYttPYmcNmq2nfVbsgfbu4h5v86lqOY0HpAM675ycyG7E%2FZqbyAkZm43dOKepMViqyM%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

❯ curl -I https://esm.sh/[email protected] \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'

HTTP/2 200
date: Wed, 04 Jan 2023 14:31:06 GMT
content-type: application/javascript; charset=utf-8
content-length: 97
cf-ray: 7844ad0a084cafe5-NRT
accept-ranges: bytes
age: 14
cache-control: public, max-age=86400
last-modified: Wed, 04 Jan 2023 14:30:52 GMT
vary: Origin, User-Agent
cf-cache-status: HIT
x-typescript-types: https://esm.sh/v102/[email protected]/types/runtime/index.d.ts
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=XxwHXDS8Z%2BcmFNS3TZsvPrhloISqm5UbkFN9N3sSEBQv%2FY5N1H9dbs5C%2BLlle7jSrEEHdrnckCWwmJcdHq6QO%2BxWVpyNdQFh0V6OxcffaXeIfT4tq%2BcR9NE%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
server: cloudflare
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

I’d recommend that esm.sh does not return 500 error. Could you check the happening?

@junish junish added the browser Not working in Browser label Jan 4, 2023
@rmorshea
Copy link

rmorshea commented Jan 5, 2023

I'm encountering a similar issue. I'm using some Python code to determine what exports a module has. As mentioned, setting the user agent to some acceptable value bypasses this problem.

@ije
Copy link
Member

ije commented Jan 7, 2023

Screenshot 2023-01-07 at 22 13 52

fixed the user-agent checking

@ije ije closed this as completed Jan 7, 2023
rmorshea added a commit to reactive-python/reactpy that referenced this issue Jan 9, 2023
rmorshea added a commit to reactive-python/reactpy that referenced this issue Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser Not working in Browser
Projects
None yet
Development

No branches or pull requests

3 participants