Answer the question
In order to leave comments, you need to log in
How to redirect curl request from http to https?
There is a site with access via http and https
htaccess entry
RewriteCond %{SERVER_PORT} !=443
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
curl --data "[email protected]&password=value2" https://mysite.example/api/authenticate
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://mysite.example/api/authenticate">here</a>
.</p>
<hr>
<address>Apache/2.2.22 (Debian) Server at myserver.example Port 80</address>
</body></html>
Answer the question
In order to leave comments, you need to log in
This is not an error, this is a valid response status. Errors are 4xx and 5xx.
In general, the curl has an option -L - with it it processes redirects.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question