Following up on my earlier question, I realized that even if I SSH into my OpenShift container and attempt to manually cURL an HTTPS URL, it seems to get internally re-routed to the HTTP equivalent. How can I actually access the HTTPS version?
From my local machine:
$ curl -X POST -H “Authorization: Basic <TOKEN>” -H “Content-Type: application/x-www-form-urlencoded” -H “Content-Length: 0” https://api.stubhub.com/login
{”error”:”invalid_request”,”error_description”:”Missing grant_type parameter value”}
And from my remote machine (via SSH):
> curl -X POST -H “Authorization: Basic <TOKEN>” -H “Content-Type: application/x-www-form-urlencoded” -H “Content-Length: 0” https://api.stubhub.com/login
<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
You don't have permission to access “http://api.stubhub.com/login” on this server.<P>
Reference #18.63de6bd1.1459386064.30c676b
</BODY>
</HTML>
Note the http URL in the latter's response body.
(And of course, I'm using a working/tested <TOKEN>.)
You should contact stubhub and see if they are blocking the ip address(es) that you are attempting the connection from. I am able to curl other https url's from OpenShift Online without any issues.
Related
I have a script that sends POST requests to Apache load balancer to change status_D parameter of the specified worker. This is supposed to enable or disable worker (0 - enable, 1 - disable).
This used to work, but not anymore. Script is in Perl, but I tried sending the same request using curl, same result - status does not change.
If I open load balancer web page in browser and change it from there - it works.
I even captured browser's POST request parameters from the Apache log, copied and pasted them into curl command, but it still did not work, which makes me think that parameters are fine, but perhaps something has changed in Apache or proxy_balancer_module recently? Apache version is 2.4.52.0.1.
In new versions you need to add the referer in the http request.
curl -s -o /dev/null -XPOST "http://${server}:${port}/${manager}?" \
-H "Referer: http://${server}:${port}/${manager}?b=${balancer}&w=${worker}&nonce=${nonce}" -d b="${balancer}" \
-d w="${worker}" -d nonce="${nonce}" -d w_status_D=1
I have problems to get Bearer access token in Jmeter. Problem's cause most probably is in
server authentication - do not really understand how to properly setup this in Jmeter.
curl consist of several parts:
curl -X POST -v https://xxxx.xxx.xx.lv/token -u
"d123c9e3-4e91-46db-931e-37e8a52b8c8d:0e7cb8ad50fe3686de05fcf46815abc0a9d7cd095c23f75446d933ccxyxy"
-d "grant_type=password" -d "username=xxxxxxx" -d "password=xxxxxx" -d "scope=scop"
I have tried to use HTTP AuthorizationManager, HTTP Request and HTTP Header Manager without any successful results. Any advices?
Thanks!
Tatjana
I think you should do something like:
HTTP Request sampler:
these protocol and Server Name bits can be moved to HTTP Request Defaults so you won't have to specify them for each and every HTTP Request sampler
HTTP Authorization Manager:
In general since JMeter 5.1 it's possible to create a test plan from curl command line, the option lives under "Tools -> Import from cURL" main menu entry:
In the code I inherited there is a REST call that sets up user permissions for a virtual host in a rabbitmq installation. On my developer box I have latest RabbitMQ server installed, 3.7.7. The client software uses a Spring RestTemplate to query the host. It generates a PUT request to http://localhost:15672/api/permissions/myhost/administrator with a payload of
{"read":".*","write":".*","configure":".*"}
and an HTTP header Content-Type:application/json;charset=UTF-8
This all looks reasonable to me - but the response is
HTTP/1.1 415 Unsupported Media Type
This code is years old, and I suspect it is my RabbitMQ installation that is too new for it, but I'd like to rather make the code future-proof than to install an RabbitMQ from 2015 ...
I have googled extensively on this issue but all I found was some bug about doubled headers in the rabbitmq client software that is not in use here. I traced it into apache httpclient classes and there is nothing on the sender side that smells.
Any suggestions what is wrong?
It turned out that the Apache HttpClient was adding a second content-type header to the message, caused the rejection on RabbitMQ Management plugin.
Yes, content type should not be applied
curl -s -i -u guest:guest -H "content-type: application/json" -H "content-type: application/json" -X POST --data '{"properties":{"delivery_mode":2},"routing_key":"program.*","payload":"{\"id\":\"123456\"}","payload_encoding":"string"}' 'http://127.0.0.1:15672/api/exchanges/%2F/my-exchange/publish'
return HTTP/1.1 415 Unsupported Media Type
Without content-type or just one :
curl -s -i -u guest:guest -H "content-type: application/json" -X POST --data '{"properties":{"delivery_mode":2},"routing_key":"program.*","payload":"{\"id\":\"123456\"}","payload_encoding":"string"}' 'http://127.0.0.1:15672/api/exchanges/%2F/my-exchange/publish'
return HTTP/1.1 200 OK
I would like access to the clash of clans API (developer.clashofclans.com) in my Vagrant box but i have an accessDenied "Invalid authorization".
This is because my ip is not allowed but what ip i do put ?
If you running on localhost, you should put your NAT, you can see it here: http://whatismyipaddress.com/
Also, an easy way to know which IP you should put you can do this trick:
Create a api key with stupid ip address
Make a curl request with this token:
curl -X GET --header "Accept: application/json" --header "authorization: Bearer " "https://api.clashofclans.com/v1/clans?name=test"
And you will get a response like this:
{"reason":"accessDenied.invalidIp","message":"Invalid authorization: API key does not allow access from IP XXX.XXX.XXX.XXX"}
Now you know for sure what ip the API is expecting from you :)
I am new to openstack, trying to use Ceilometer python API to pull some data from a testbed server, I am accessing the server from a remote site
the problem is that I cannot figure out how get the an authorization token
I used the following command
curl -i 'http://HOST:8774/' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d/tokens auth": {"tenantName": "project", "passwordCredentials": {"username": "user", "password": "password"}}}'
But it does not give me anything,
curl -X GET -H "X-Auth-Token:$MY_TOKEN" http://HOST:8774/tokens
also does not give me any token
From your use of port 8774 I suspect you might be using DevStack. Try this
curl -s -X POST http://$OPENSTACK_KEYSTONE_HOST:5000/v2.0/tokens -d '{"auth": {"passwordCredentials": {"username":"my-username", "password":"my-password"}, "tenantName":"my-tenantName"}}
In DevStack Keystone (the auth service you get tokens from) is running on port 5000 by default. This may or may not be true in your case. Ask your friendly OpenStack operator what host (and port) Keystone is running on and put that in place of $OPENSTACK_KEYSTONE_HOST:5000