Curl GET not returning page

Curl GET not returning page

using the command:

curl https://valuable-terrace.localsite.io/?p=24

does not return the page, but instead returns:

<html>
<head><title>308 Permanent Redirect</title></head>
<body>
<center><h1>308 Permanent Redirect</h1></center>
<hr><center>nginx</center>
</body>
</html>

How can I configure WPLocal(?) to return the page on a curl GET request? Thanks.
rickyg.

System Details

  • Local Version:
    Version 9.0.4+6699

  • Operating System (OS) and OS version:
    Edition Windows 10 Pro
    Version 22H2
    Installed on ‎10/‎12/‎2020
    OS build 19045.4529
    Experience Windows Feature Experience Pack 1000.19058.1000.0


Local Logs

Log attached.
local-lightning-verbose.log (105.2 KB)


Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

I was able to access a page over Live Links using curl with something like this:

curl -L -sH 'Accept-encoding: gzip' "https://<username>:<password>@<subdomain>.localsite.io/" | gunzip -

So for example, something like:

curl -L -sH 'Accept-encoding: gzip' "https://paperweight:tricky@intelligent-papaya.localsite.io/?p=23" | gunzip -

Breaking it down a bit:

  • The response is compressed, so you need to account for that in your command
  • Live Links are protected by basic HTTPS auth, so you need to include those things in the url

All that being said though, your command is giving a 308 response code, which almost seems like you are hitting the site, but something is doing a redirect. Maybe you can try using the -L flag for curl to follow redirects? Or maybe temporarily disable whatever is causing that redirect to happen?

Thanks, Ben.

Are these two separate Curl transactions? 1) Can the first one be used to authenticate and then any number of curl requests can be used until the session is closed and reauthenticated again?

  • or -
  1. Does each curl transaction have to involve two commands. The first to authenticate, the second to run a specific curl command.

Appreciate your help in enlightening my understanding.

rickyg.

It’s just one Curl command that looks like two because we’re including some configuration headers. To explain things a little more in depth:

The -L is for “follow” in case there are any redirects. I don’t think that’s necessary for Live Links, but I often include it by habit because usually I want the actual “thing” I’m after, even if there is a redirect.

The -sH 'Accept-encoding: gzip' part is essentially saying “Add this header to the request” which in this case is letting the server know that we can accept a compressed response.

The next string in quotes is the url that we want to get things from.