Thank you very much Federico, actually I finally solved my issue.

The issue came from the fact that my URL was an IP address. It was a valid 
one, but still a different IP address from the default one in the vagrant 
file for the controller configuration (192.168.56.5). It looks like the 
controller server does not like when it's requested from a different IP 
address... It looks it's some kind of vhost issue that you can have when 
configuring a web server.

So I finally solved my issue by setting a real URL, that I defined in the 
/etc/hosts file on the agent's machine. The agent is now registering 
perfectly well to the controller. 

Yves

Le lundi 19 juillet 2021 à 22:44:09 UTC+2, federico...@gmail.com a écrit :

> Hi Yves,
>
> when this happens, you should verify what URL openwisp-config is trying to 
> fetch and call the same curl command the agent is calling to see the result.
>
> That response is coming from nginx, so nginx is replying 404, the reasons 
> could be many:
>
> - URL is pointing to another server
> - Nginx is not finding the uwsgi application server and returning 404
>
> This is how a good response looks like, you can try this command and see 
> what you receive:
>
> curl -v -I "$(uci get openwisp.http.url)"
> > HEAD / HTTP/1.1
> > Host: openwisp.******.com
> > User-Agent: curl/7.77.0
> > Accept: */*
> > 
> < HTTP/1.1 302 Found
> HTTP/1.1 302 Found
> < Server: nginx/1.18.0 (Ubuntu)
> Server: nginx/1.18.0 (Ubuntu)
> < Date: Mon, 19 Jul 2021 20:42:37 GMT
> Date: Mon, 19 Jul 2021 20:42:37 GMT
> < Content-Type: text/html; charset=utf-8
> Content-Type: text/html; charset=utf-8
> < Content-Length: 0
> Content-Length: 0
> < Connection: keep-alive
> Connection: keep-alive
> < Location: /admin/
> Location: /admin/
> < X-Frame-Options: DENY
> X-Frame-Options: DENY
> < Vary: Origin, Accept-Language
> Vary: Origin, Accept-Language
> < Content-Language: en
> Content-Language: en
> < X-Content-Type-Options: nosniff
> X-Content-Type-Options: nosniff
> < Referrer-Policy: same-origin
> Referrer-Policy: same-origin
> < Strict-Transport-Security: max-age=31536000
> Strict-Transport-Security: max-age=31536000
> < X-Content-Type-Options: nosniff
> X-Content-Type-Options: nosniff
>
>
> On Friday, July 16, 2021 at 10:27:56 AM UTC-5 yba...@gmail.com wrote:
>
>>
>> Hello,
>>
>> I've installed the openwisp agent on a router. And I've installed the 
>> openwisp controller on a VirtualBox using the Ansible installation. Now 
>> I've configured the agent to automatically register to the controller. But 
>> the agent fails in connecting to the controller. Here is the end of the 
>> `logread` command:
>> ```
>> Tue Feb 16 16:42:00 2021 daemon.info openwisp: OpenWISP config agent 
>> started
>> Tue Feb 16 16:42:00 2021 daemon.info openwisp: Registering device...
>> Tue Feb 16 16:42:01 2021 daemon.err openwisp: Invalid url: missing 
>> X-Openwisp-Controller header
>> Tue Feb 16 16:42:01 2021 daemon.info procd: Instance 
>> openwisp_config::instance1 s in a crash loop 7 crashes, 0 seconds since 
>> last crash
>> ```
>>
>> The agent complains the X-Openwisp-Controller header is missing.
>>
>> Here is the content of the registration_parameter file:
>> ```
>> root@OpenWrt:~# cat /tmp/openwisp/registration_parameters
>> HTTP/1.1 404 Not Found
>> Server: nginx/1.14.2
>> Date: Fri, 16 Jul 2021 14:48:06 GMT
>> Content-Type: text/html
>> Content-Length: 169
>> Connection: keep-alive
>>
>> <html>
>> <head><title>404 Not Found</title></head>
>> <body bgcolor="white">
>> <center><h1>404 Not Found</h1></center>
>> <hr><center>nginx/1.14.2</center>
>> </body>
>> </html>
>>
>> ```
>>
>> It returns a 404 error.
>>
>> Does anyone have an idea? Is there any information on the controller side 
>> I can use to solve this issue?
>>
>> Regards
>> Yves
>>
>>
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to openwisp+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/openwisp/e00f5a7e-baf0-41ba-ae41-39dfabb2fc53n%40googlegroups.com.

Reply via email to