-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
How to enable CORS for Podman REST APIs #8645
Comments
A friendly reminder that this issue had no activity for 30 days. |
@adamchew89 Could you try this again against the latest code in main branch? |
@jwhonce Can you help out @adamchew89 ? |
A friendly reminder that this issue had no activity for 30 days. |
@adamchew89 Any progress on this? |
A friendly reminder that this issue had no activity for 30 days. |
@adamchew89 The Podman team discussed adding this feature. We are open to making this change, but at this time do not see the demand to add the feature to our roadmap. We would be happy to accept a PR with the change. /cc @baude |
A friendly reminder that this issue had no activity for 30 days. |
A friendly reminder that this issue had no activity for 30 days. |
You got it. |
A friendly reminder that this issue had no activity for 30 days. |
@boaz0 Did you ever get a chance to work on this? |
I did work on it here #10546 and now what I need to do is writing tests for it and then I am OK with closing this. |
Great. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind feature
Description
Unable to call Podman REST API from web application due to CORS. How do I enable CORS on Podman REST API.
Able to overcome CORS issue for GET methods by installing firefox plugin https://mybrowseraddon.com/access-control-allow-origin.html but not working for POST methods.
Steps to reproduce the issue:
Start Podman with:
podman system service --time=50000 tcp:localhost:7080 --log-level=debug --time=0
Manually create dummy pod with:
podman pod create dummy
On JSFiddle: Run the following with Javascript + jQuery 1.9.1
$.get('http://localhost:7080/v1.40.0/libpod/pods/dummy/json').then(response=> console.log({response})).catch(error=>console.log({error}));
Describe the results you received:
Received CORS error:
Invalid X-Frame-Options header was found when loading “https://fiddle.jshell.net/_display/?editor_console=true”: “ALLOWALL” is not a valid directive.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:7080/v1.40.0/libpod/pods/dm-perception-pod-0/json. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
{ "error": { "readyState": 0, "status": 0, "statusText": "error" } }
Describe the results you expected:
To receive Podman REST Api response that may look like this:
{ "Id": "c68c0db77cca1b632bf075f3b3c4bb90b056f21948a1f5f97d0dab4c1e385b65", "Name": "dummy", "Created": "2020-12-07T15:19:56.167536112+08:00", "CreateCommand": [ "podman", "pod", "create", "-n", "dummy" ], "State": "Running", "Hostname": "dummy", "CreateCgroup": true, "CgroupParent": "/libpod_parent", "CgroupPath": "/libpod_parent/c68c0db77cca1b632bf075f3b3c4bb90b056f21948a1f5f97d0dab4c1e385b65", "CreateInfra": true, "InfraContainerID": "e72e2d9521b4d95274dd5f4f43c6c451bd3bb351b03f7ad17b95ff1babfaf8b6", "InfraConfig": { "PortBindings": {}, "HostNetwork": false, "StaticIP": "", "StaticMAC": "", "NoManageResolvConf": false, "DNSServer": null, "DNSSearch": null, "DNSOption": null, "NoManageHosts": false, "HostAdd": null, "Networks": null, "NetworkOptions": null }, "SharedNamespaces": [ "uts", "ipc", "net" ], "NumContainers": 1, "Containers": [ { "Id": "e72e2d9521b4d95274dd5f4f43c6c451bd3bb351b03f7ad17b95ff1babfaf8b6", "Name": "c68c0db77cca-infra", "State": "running" } ] }
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
VirtualBox 6.1 w/ Ubuntu 20.04.01 VM on Windows 10 host.
The text was updated successfully, but these errors were encountered: