Issue

While executing cURL commands, no feedback is received from AEM. The terminal displays no results after the command execution.
For example, the command below returns nothing

curl -u admin:pass http://IP:PORT/

Cause

The cURL command does not display any results on the terminal because the response sent by AEM server contains no message in the body of the HTML response. Instead, the HTTP error code is displayed in the headers of the HTTP response.

Usually, the problem is either the user name and password provided in the curl command are not correct, or the credentials are not getting through as expected to the AEM server. To understand the problem, use -v flag in the cURL command to understand the nature of the error.

The following command, which returns no results can be modified as explained below:

FROM
curl -u admin: pass http://IP:PORT/
TO
curl -v -u admin: pass http://IP:PORT/

The result on the terminal may appear such as the following, which indicates the error code as HTTP 401 Unauthorized.

*   Trying ::1...
* Connected to IP (::1) port PORT (#0)
* Server auth using Basic with user 'admin'
> GET /aem/start.html HTTP/1.1
> Host: IP:PORT
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 401 Unauthorized
< Date: Thu, 17 May 2018 14:05:09 GMT
* Authentication problem. Ignoring this.
< WWW-Authenticate: Basic realm="Sling (Development)"
< Transfer-Encoding: chunked
< 
* Connection #0 to host IP:PORT left intact

Resolution

  • Confirm that the credentials used in the cURL command are accurate and a user can log in to AEM using the same credentials.
  • If the user is able to log in to AEM using the same credentials, then the issue is probably with the delivery of the credentials. In this case, wrapping the credentials in single quotes can resolve the issue. This is usually the case where there are some special characters in the password such as $,@, and so on.
curl -v -u 'admin:pass' http://IP:PORT/

Additional information

You can confirm if you are getting other errors by adding the -v flag to the curl command to include the HTTP headers in the output such as:
curl -v -u admin: admin http://localhost:4502/crx/packmgr/service.jsp?cmd=help

Bu çalışma Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License kapsamında lisanslanmıştır  Creative Commons şartları, Twitter™ ve Facebook sitelerinde paylaşılanları kapsamaz.

Yasal Uyarılar   |   Çevrimiçi Gizlilik İlkesi