lxd-webgui icon indicating copy to clipboard operation
lxd-webgui copied to clipboard

Couldn't get config but API access Ok

Open epaumerat opened this issue 7 years ago • 9 comments

Hello,

so I have setup the web server with its certificate and a certificate for my browser (on my Mac). LXD and lxd-webgui are on the same server. I still get the "couldn't get config from..." but I can access the LXD API trough my browser.

Lxd config :

config: core.https_address: 10.3.12.1:8443 core.https_allowed_credentials: "true" core.https_allowed_headers: Origin, X-Requested-With, Content-Type, Accept core.https_allowed_methods: GET, POST, PUT, DELETE, OPTIONS core.https_allowed_origin: '*' core.trust_password: true

I have put the lxd server on debug mode also but no error except a warning for my Mac IP address. See the 2 screenshots enclosed for details maybe.

Thanks lxd_2 lxd_1

epaumerat avatar May 02 '17 14:05 epaumerat

hello

i have the same problem, this is from https://localhost:9000/ {"type":"sync","status":"Success","status_code":200,"operation":"","error_code":0,"error":"","metadata":["/1.0"]}

ascorbic-acid avatar May 13 '17 10:05 ascorbic-acid

I have same problem too on Ubuntu 14.04. Please help.

iqs-systems avatar Jul 20 '17 21:07 iqs-systems

Same here, maybe I should have looked here first at the unanswered post going back to may.

PBXForums avatar Aug 08 '17 22:08 PBXForums

Sorry, other projects had higher priority than this one. Will look into it the next few days.

dobin avatar Sep 06 '17 07:09 dobin

Ok guys, can you try to specify the allowed IP addresses, instead of using "*"?

$ sudo lxc config set core.https_allowed_origin <your_ip_addess>

Maybe <your_ip_address> is 127.0.0.1, or your real internal ip (192.168....).

dobin avatar Sep 06 '17 07:09 dobin

I am in the same situation. Here is my lxc config: config: core.https_address: 0.0.0.0:9000 core.https_allowed_credentials: "true" core.https_allowed_headers: Origin, X-Requested-With, Content-Type, Accept core.https_allowed_methods: GET, POST, PUT, DELETE, OPTIONS core.https_allowed_origin: 10.1.0.10 core.trust_password: true I've tried the following settings for core.https_allowed_origin: https://localhost:8000 https://0.0.0.0:8000 https://10.1.0.10:8000 (Server IP address) https://10.1.0.86:8000 (Remote PC IP address accessing WEBGUI) "*" All of these setting result in the same "Could not get config from server: https://localhost:9000" error. Any assistance would be appreciated. I rebuilt the Ubuntu 16.04 server and followed the following guide to install lxd: https://linuxcontainers.org/lxd/getting-started-cli/

I can access the API at the following URL: http://10.1.0.10:9000 and I receive the following response: {"type":"sync","status":"Success","status_code":200,"operation":"","error_code":0,"error":"","metadata":["/1.0"]}

I am running the web server using the following command: http-server -S -a 0.0.0.0 -p 8000

Any assistance would be greatly appreciated. I cannot find any errors in the lxd.log and nothing in journalctl -xe. Are there any other places to look for errors?

Thanks in advance.

tgrenda34 avatar Nov 09 '17 19:11 tgrenda34

Thanks a lot. I was initially unable to make lxd-webgui work too (again...). but after some hours of debugging:

There are a variety of problems here:

  • The LXD version of Ubuntu 16.04 does not support the "core.https_allowed_credentials", which is pretty important
  • Chrome will use "localhost:8000" as origin
  • While Firefox will use "127.0.0.1:8000" as origin
  • Firefox will not send its client certificate on XHR requests if "with-credentials" in not specified in the ajax request (therefore depends on the allowed_credentials response header)

So i got it to work on Ubuntu 16.04 with:

  • Chrome
  • core.https_allowed_origin "https://localhost:8000"
  • "send XHRs with credentials" DISABLED

CC #42, #39, #36

dobin avatar Nov 13 '17 17:11 dobin

For further reference: Debugging involves using F12 "Console" to see Cross-Origin request error, "Network" to see actual requests and HTTP headers, and starting LXD with the following command line:

/usr/bin/lxd --group lxd --logfile=/var/log/lxd/lxd.log --debug --verbose

dobin avatar Nov 13 '17 17:11 dobin

I got it working in firefox by setting: core.https_allowed_origin "https://127.0.0.1:8000"

as firefox doesn't send localhost

najamelan avatar Jan 03 '18 02:01 najamelan