# Ansible Get\_url module response HTTP Bad Request

**URL:** <https://forum.ansible.com/t/ansible-get-url-module-response-http-bad-request/23853>\
**Category:** Ansible Project\
**Created:** [March 1, 2017, 3:14pm UTC](https://forum.ansible.com/t/ansible-get-url-module-response-http-bad-request/23853 "2017-03-01T15:14:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shyam\_Yenna](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Shyam\_Yenna](https://forum.ansible.com/u/Shyam_Yenna)\
**Post date:** [March 1, 2017, 3:14pm UTC](https://forum.ansible.com/t/ansible-get-url-module-response-http-bad-request/23853/1 "2017-03-01T15:14:48Z")

</div>

I am implementing below task and it throwing me HTTP Error: 400 Bad Request

FAILED! =\> {  
“changed”: false,  
“dest”: “/tmp”,  
“failed”: true,  
“gid”: 0,  
“group”: “root”,  
“invocation”: {  
“module\_args”: {  
“backup”: false,  
“checksum”: “md5:a33bdf347d40110c6d64d100fabc056d”,  
“content”: null,  
“delimiter”: null,  
“dest”: “/tmp”,  
“directory\_mode”: null,  
“follow”: false,  
“force”: false,  
“force\_basic\_auth”: false,  
“group”: null,  
“headers”: null,  
“http\_agent”: “ansible-httpget”,  
“mode”: null,  
“owner”: null,  
“regexp”: null,  
“remote\_src”: null,  
“selevel”: null,  
“serole”: null,  
“setype”: null,  
“seuser”: null,  
“sha256sum”: “”,  
“src”: null,  
“timeout”: 10,  
“tmp\_dest”: “”,  
“unsafe\_writes”: null,  
“url”: “[https://backstage.forgerock.com/downloads/OpenDJ/OpenDJ](https://backstage.forgerock.com/downloads/OpenDJ/OpenDJ) Enterprise/3.0.0/OpenDJ 3 Zip/OpenDJ-3.0.0.zip”,  
“url\_password”: “password”,  
“url\_username”: “user”,  
“use\_proxy”: true,  
“validate\_certs”: true  
},  
“module\_name”: “get\_url”  
},  
“mode”: “01777”,  
“msg”: “Request failed”,  
“owner”: “root”,  
“response”: “HTTP Error 400: Bad request”,  
“size”: 4096,  
“state”: “directory”,  
“status\_code”: 400,  
“uid”: 0,  
“url”: “[http://backstage.forgerock.com/downloads/OpenDJ/OpenDJ](http://backstage.forgerock.com/downloads/OpenDJ/OpenDJ) Enterprise/3.0.0/OpenDJ 3 Zip/OpenDJ-3.0.0.zip”  
}

I appreciate any help.

Thanks  
Shyam

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 2, 2017, 8:51am UTC](https://forum.ansible.com/t/ansible-get-url-module-response-http-bad-request/23853/2 "2017-03-02T08:51:46Z")

</div>

> I am implementing below task and it throwing me HTTP Error: 400 Bad Request

That's not a task, but the (failed) output of it.

Since you didn't post your actual task, I will guess that you're  
downloading a ZIP file, but forgot to escape the spaces in the URL:

visser@cajones:~$ curl -I  
"[https://backstage.forgerock.com/downloads/OpenDJ/OpenDJ](https://backstage.forgerock.com/downloads/OpenDJ/OpenDJ)  
Enterprise/3.0.0/OpenDJ 3 Zip/OpenDJ-3.0.0.zip"  
HTTP/1.0 200 Connection established

HTTP/1.0 400 Bad request  
Cache-Control: no-cache  
Connection: close  
Content-Type: text/html

Compare this to:

visser@cajones:~$ curl -I  
"[https://backstage.forgerock.com/downloads/OpenDJ/OpenDJ%20Enterprise/3.0.0/OpenDJ%203%20Zip/OpenDJ-3.0.0.zip&quot](https://backstage.forgerock.com/downloads/OpenDJ/OpenDJ%20Enterprise/3.0.0/OpenDJ%203%20Zip/OpenDJ-3.0.0.zip&quot);  
HTTP/1.0 200 Connection established

HTTP/1.1 200 OK  
Server: Apache/2.4.6 (Red Hat) OpenSSL/1.0.0-fips OpenAM WPA/3.3.4  
X-Frame-Options: SAMEORIGIN  
Last-Modified: Fri, 17 Feb 2017 10:40:55 GMT  
Accept-Ranges: bytes  
Content-Length: 2128  
Vary: Accept-Encoding  
Cache-Control: max-age=0,no-cache  
nid: prod2  
Content-Type: text/html; charset=UTF-8  
Set-Cookie: fr\_backstage\_lb\_prod=prod2; path=/

However, this isn't a file but instead a web page asking to sign in.  
With valid credentials that might work, but it could also be that the  
server want something more fancy than basic auth.  
It's up to you to find that out.  
If that happens, you'd probably have to store a cookie first.

Note that your URL initially gets redirected to HTTPS - you might want  
to use that to start with.

Dick
