René's URL Explorer Experiment


Title: Add a --cors command line option to stdlib http.server · Issue #135056 · python/cpython · GitHub

Open Graph Title: Add a --cors command line option to stdlib http.server · Issue #135056 · python/cpython

X Title: Add a --cors command line option to stdlib http.server · Issue #135056 · python/cpython

Description: Feature or enhancement Proposal: Add a --cors command line option to the http.server stdlib module, which when specified will add this CORS header to all responses: Access-Control-Allow-Origin: * This is useful during local web developme...

Open Graph Description: Feature or enhancement Proposal: Add a --cors command line option to the http.server stdlib module, which when specified will add this CORS header to all responses: Access-Control-Allow-Origin: * T...

X Description: Feature or enhancement Proposal: Add a --cors command line option to the http.server stdlib module, which when specified will add this CORS header to all responses: Access-Control-Allow-Origin: * T...

Opengraph URL: https://github.com/python/cpython/issues/135056

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add a --cors command line option to stdlib http.server","articleBody":"# Feature or enhancement\n\n### Proposal:\n\nAdd a `--cors` command line option to the `http.server` stdlib module, which when specified will add this CORS header to all responses:\n```\nAccess-Control-Allow-Origin: *\n```\n\nThis is useful during local web development, which is a common use case for `http.server`. If a user is developing Javascript on one local web server, and making Javascript requests against static assets served by a separately running `python -m http.server`, those requests will fail due to the browser's default cross-origin request policy. With the rise in popularity of tools like pyodide and pyscript, whose implementations are subject to the same Javascript cross-origin request logic, I expect similar use cases to this to become more common. It would be useful for `http.server` to support an open cross-origin response header via the command line like so:\n\n```shell\npython -m http.server --cors\n```\n\nThis allows the user to serve static assets locally that can be requested by Javascript anywhere the server is visible. The new headers are opt-in only, no default behavior is changed without the flag.\n\n### Has this already been discussed elsewhere?\n\nI have already discussed this feature proposal on Discourse\n\n### Links to previous discussion of this feature:\n\nI started a thread about this feature on python-ideas:\nhttps://discuss.python.org/t/any-interest-in-adding-a-cors-option-to-python-m-http-server/92120/10\n\nThe thread has a mixed response. Some are for it, some against, and some are in favor of a more generalized approach. I discussed the feature with some developers in person at Pycon 2025, the result being that there is possibly enough interest to add this feature. \n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-135057\n* gh-149320\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/aisipos","@type":"Person","name":"aisipos"},"datePublished":"2025-06-03T04:38:05Z","url":"https://github.com/python/cpython/issues/135056"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:7bd2ada5-2379-8e97-c007-683b1f3a39ac
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idDB96:28BF7E:3BDAAE:5031DD:6AECCA51
html-safe-noncea2d5ae3f2d0b0361c270e0766c7db7811307415450a3b550677902a0cd94a2aa
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjk2OjI4QkY3RTozQkRBQUU6NTAzMUREOjZBRUNDQTUxIiwidmlzaXRvcl9pZCI6IjQ3NDExODYzNDk0MTY4OTMwMDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmace46a9fd0e401b466e88839b44588c69b117033c05b86a85de7803adc76e00fb4
hovercard-subject-tagissue:3112357483
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/135056/issue_layout
twitter:imagehttps://opengraph.githubassets.com/19253e0395adf12be74692cb55d2d1cf8e298690a0d64ffd829f161acf901b1a/python/cpython/issues/135056
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/19253e0395adf12be74692cb55d2d1cf8e298690a0d64ffd829f161acf901b1a/python/cpython/issues/135056
og:image:altFeature or enhancement Proposal: Add a --cors command line option to the http.server stdlib module, which when specified will add this CORS header to all responses: Access-Control-Allow-Origin: * T...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameaisipos
hostnamegithub.com
expected-hostnamegithub.com
Nonedc0b519c5798dc1150b88dc4c06a8b9634d0069218dc04e469970e76aad74016
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasedb139f0bf57b59bf9a8c4abb0849924d6c6ca559
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/135056#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F135056
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F135056
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/135056
Reloadhttps://github.com/python/cpython/issues/135056
Reloadhttps://github.com/python/cpython/issues/135056
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.3k (2.3k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/pulse
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/135056
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/135056
Add a --cors command line option to stdlib http.serverhttps://github.com/python/cpython/issues/135056#top
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
https://github.com/aisipos
aisiposhttps://github.com/aisipos
on Jun 3, 2025https://github.com/python/cpython/issues/135056#issue-3112357483
https://discuss.python.org/t/any-interest-in-adding-a-cors-option-to-python-m-http-server/92120/10https://discuss.python.org/t/any-interest-in-adding-a-cors-option-to-python-m-http-server/92120/10
gh-135056: Add a --header CLI argument to http.server #135057https://github.com/python/cpython/pull/135057
gh-135056: Fix teardown order for Windows in test_httpservers #149320https://github.com/python/cpython/pull/149320
Nexthttps://github.com/python/cpython/issues/135056?timeline_page=1
aisiposhttps://github.com/aisipos
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
on Jun 3, 2025https://github.com/python/cpython/issues/135056#event-17947862106
aisiposhttps://github.com/aisipos
on Jun 3, 2025https://github.com/python/cpython/issues/135056#event-17948149735
pythongh-135056: Add a --cors CLI argument to http.serverhttps://github.com/aisipos/cpython/commit/f151507bcaff76f02aa3f147ca394a098a37a621
pythongh-135056https://github.com/python/cpython/issues/135056
f151507https://github.com/aisipos/cpython/commit/f151507bcaff76f02aa3f147ca394a098a37a621
pythongh-135056: Add a --cors CLI argument to http.serverhttps://github.com/aisipos/cpython/commit/3f11652eb81a1db9a9d2f2efc6114b87b275fe0e
pythongh-135056https://github.com/python/cpython/issues/135056
3f11652https://github.com/aisipos/cpython/commit/3f11652eb81a1db9a9d2f2efc6114b87b275fe0e
pythongh-135056: Add a --cors CLI argument to http.serverhttps://github.com/aisipos/cpython/commit/0d02fbe1a3566985f2d17934988a9fe7b62135f4
pythongh-135056https://github.com/python/cpython/issues/135056
0d02fbehttps://github.com/aisipos/cpython/commit/0d02fbe1a3566985f2d17934988a9fe7b62135f4
picnixzhttps://github.com/picnixz
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
on Jun 7, 2025https://github.com/python/cpython/issues/135056#event-18035970203
aisiposhttps://github.com/aisipos
on Jun 20, 2025https://github.com/python/cpython/issues/135056#event-18238045132
pythongh-135056: Simplifications and cleanups to http cors changes.https://github.com/aisipos/cpython/commit/77b5fff86aa309120c49c206e795765161753dab
pythongh-135056https://github.com/python/cpython/issues/135056
77b5fffhttps://github.com/aisipos/cpython/commit/77b5fff86aa309120c49c206e795765161753dab
pythongh-135056: Add a --header argument to http.server cli.https://github.com/aisipos/cpython/commit/5f89c97c15f7cd240cec2ba4fc2eec55d0d19f54
pythongh-135056https://github.com/python/cpython/issues/135056
5f89c97https://github.com/aisipos/cpython/commit/5f89c97c15f7cd240cec2ba4fc2eec55d0d19f54
aisiposhttps://github.com/aisipos
on Jul 10, 2025https://github.com/python/cpython/issues/135056#event-18558782243
pythongh-135056: Remove --cors opt from http.server in favor of --headerhttps://github.com/aisipos/cpython/commit/a3243fe679166211ab1db3ea57cadeb50a3fbbdb
pythongh-135056https://github.com/python/cpython/issues/135056
a3243fehttps://github.com/aisipos/cpython/commit/a3243fe679166211ab1db3ea57cadeb50a3fbbdb
pythongh-135056: Use response_headers only in SimpleHTTPRequestHandlerhttps://github.com/aisipos/cpython/commit/b1026d2a1faeec3c323467f5d7ca354f0712604a
pythongh-135056https://github.com/python/cpython/issues/135056
b1026d2https://github.com/aisipos/cpython/commit/b1026d2a1faeec3c323467f5d7ca354f0712604a
pythongh-135056: Add test for http.server cli --header argumenthttps://github.com/aisipos/cpython/commit/6f88c13a4338dd33827e7cd929e7744ef63d3aca
pythongh-135056https://github.com/python/cpython/issues/135056
6f88c13https://github.com/aisipos/cpython/commit/6f88c13a4338dd33827e7cd929e7744ef63d3aca
pythongh-135056: Support multiple headers of the same name.https://github.com/aisipos/cpython/commit/7a793f2d4be5394645b3da17c16a4468f640a875
pythongh-135056https://github.com/python/cpython/issues/135056
7a793f2https://github.com/aisipos/cpython/commit/7a793f2d4be5394645b3da17c16a4468f640a875
pythongh-135056: Remove some commented out and unused code.https://github.com/aisipos/cpython/commit/9450b868516e80d775449b7f496795e127ef3e42
pythongh-135056https://github.com/python/cpython/issues/135056
9450b86https://github.com/aisipos/cpython/commit/9450b868516e80d775449b7f496795e127ef3e42
pythongh-135056: Capitalize CLI acronym in the docs.https://github.com/aisipos/cpython/commit/5a30d914ad194bfac400bbaa5e699bd77f9785ed
pythongh-135056https://github.com/python/cpython/issues/135056
5a30d91https://github.com/aisipos/cpython/commit/5a30d914ad194bfac400bbaa5e699bd77f9785ed
pythongh-135056: Simplify args.header processing.https://github.com/aisipos/cpython/commit/d317cc2d333f7b8b340e5133378cdc64b5b377e7
pythongh-135056https://github.com/python/cpython/issues/135056
d317cc2https://github.com/aisipos/cpython/commit/d317cc2d333f7b8b340e5133378cdc64b5b377e7
aisiposhttps://github.com/aisipos
on Aug 12, 2025https://github.com/python/cpython/issues/135056#event-19103915276
pythongh-135056: Factor out a _make_server function from test function.https://github.com/aisipos/cpython/commit/5f1fb944d41ea6604b2bab7ce9afd91ac33edabf
pythongh-135056https://github.com/python/cpython/issues/135056
5f1fb94https://github.com/aisipos/cpython/commit/5f1fb944d41ea6604b2bab7ce9afd91ac33edabf
aisiposhttps://github.com/aisipos
on Oct 10, 2025https://github.com/python/cpython/issues/135056#event-20198896575
pythongh-135056: Fix socket closing in test_extra_response_headers_arghttps://github.com/aisipos/cpython/commit/79c577b4f9f491669c63f7b41a75574a2d43cbd0
pythongh-135056https://github.com/python/cpython/issues/135056
79c577bhttps://github.com/aisipos/cpython/commit/79c577b4f9f491669c63f7b41a75574a2d43cbd0
aisiposhttps://github.com/aisipos
on Apr 12, 2026https://github.com/python/cpython/issues/135056#event-24426559209
pythongh-135056: Don't let extra headers overwrite default headershttps://github.com/aisipos/cpython/commit/43b0d51fdef4b11a3dc804fbfb9ff82e58e8caa0
pythongh-135056https://github.com/python/cpython/issues/135056
43b0d51https://github.com/aisipos/cpython/commit/43b0d51fdef4b11a3dc804fbfb9ff82e58e8caa0
pythongh-135056: Don't let extra headers overwrite default headershttps://github.com/aisipos/cpython/commit/3a4fed61a56f187d9538c06de933956c064f1a52
pythongh-135056https://github.com/python/cpython/issues/135056
3a4fed6https://github.com/aisipos/cpython/commit/3a4fed61a56f187d9538c06de933956c064f1a52
pythongh-135056: Fix attribute access to default_response_headershttps://github.com/aisipos/cpython/commit/9f0ed013dfb8c1b86ecbd166887b97f8644e0da8
pythongh-135056https://github.com/python/cpython/issues/135056
9f0ed01https://github.com/aisipos/cpython/commit/9f0ed013dfb8c1b86ecbd166887b97f8644e0da8
aisiposhttps://github.com/aisipos
on Apr 28, 2026https://github.com/python/cpython/issues/135056#event-24934453182
pythongh-135056: Use proper RST syntax for attribute references.https://github.com/aisipos/cpython/commit/1036a910adbe36bd1e483cd0f52bb67bf005e50a
pythongh-135056https://github.com/python/cpython/issues/135056
1036a91https://github.com/aisipos/cpython/commit/1036a910adbe36bd1e483cd0f52bb67bf005e50a
pythongh-135056: Make more new args and attrs private.https://github.com/aisipos/cpython/commit/49ffc921a5d8d51403ba195bd212c190444bbe49
pythongh-135056https://github.com/python/cpython/issues/135056
49ffc92https://github.com/aisipos/cpython/commit/49ffc921a5d8d51403ba195bd212c190444bbe49
pythongh-135056: Add multithreaded test for extra_response_headershttps://github.com/aisipos/cpython/commit/280cea30c38abedbdff926a90163ac446ff9a69f
pythongh-135056https://github.com/python/cpython/issues/135056
280cea3https://github.com/aisipos/cpython/commit/280cea30c38abedbdff926a90163ac446ff9a69f
pythongh-135056: Fix test_extra_response_headers_concurrent_requestshttps://github.com/aisipos/cpython/commit/d1889778754076f31a79b4cc5e5d3abe9328560c
pythongh-135056https://github.com/python/cpython/issues/135056
d188977https://github.com/aisipos/cpython/commit/d1889778754076f31a79b4cc5e5d3abe9328560c
pythongh-135056: Don't raise exceptions in threaded tests child threads.https://github.com/aisipos/cpython/commit/98516223237497be00d032d39a4dbff05b41f356
pythongh-135056https://github.com/python/cpython/issues/135056
9851622https://github.com/aisipos/cpython/commit/98516223237497be00d032d39a4dbff05b41f356
pythongh-135056: Add addCleanup calls to ensure test server thread ex…https://github.com/aisipos/cpython/commit/c40f8b15ee8573ebdc6938cfb8f7e704d9a1a8a4
pythongh-135056https://github.com/python/cpython/issues/135056
c40f8b1https://github.com/aisipos/cpython/commit/c40f8b15ee8573ebdc6938cfb8f7e704d9a1a8a4
pythongh-135056: Refactor _default_reponse_headers usage.https://github.com/aisipos/cpython/commit/597b973ffccca4031bed84734f75b72395b9fa7c
pythongh-135056https://github.com/python/cpython/issues/135056
597b973https://github.com/aisipos/cpython/commit/597b973ffccca4031bed84734f75b72395b9fa7c
pythongh-135056: Remove test_extra_response_headers_concurrent_requestshttps://github.com/aisipos/cpython/commit/347b968b0d687eb57aae9a0d8d1a35316f577fdb
pythongh-135056https://github.com/python/cpython/issues/135056
347b968https://github.com/aisipos/cpython/commit/347b968b0d687eb57aae9a0d8d1a35316f577fdb
picnixzhttps://github.com/picnixz
on May 3, 2026https://github.com/python/cpython/issues/135056#event-25105925101
gh-135056: Add a `--header` CLI option to `http.server` (#135057)https://github.com/python/cpython/commit/836fbdaaf32c355c7e8fb0af69f78fbbb28af8b1
gh-135056https://github.com/python/cpython/issues/135056
#135057https://github.com/python/cpython/pull/135057
836fbdahttps://github.com/python/cpython/commit/836fbdaaf32c355c7e8fb0af69f78fbbb28af8b1
picnixzhttps://github.com/picnixz
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on May 3, 2026https://github.com/python/cpython/issues/135056#event-25105944266
hugovkhttps://github.com/hugovk
on May 3, 2026https://github.com/python/cpython/issues/135056#event-25109748839
gh-135056: Fix teardown order for Windows in `test_httpservers` (#149320https://github.com/python/cpython/commit/0bf6e31941f761764b0129499dedd6572ee0d37a
gh-135056https://github.com/python/cpython/issues/135056
#149320https://github.com/python/cpython/pull/149320
0bf6e31https://github.com/python/cpython/commit/0bf6e31941f761764b0129499dedd6572ee0d37a
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/135056
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/135056
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.