Reverse Proxy - No content available because this request was redirected

1. Caddy version (caddy version):

v2.4.6 h1:HGkGICFGvyrodcqOOclHKfvJC0qTU7vny/7FhYp9hNw=

2. How I run Caddy:

CSMM - https://xpoz.cc - 127.0.0.1:1337

Playground React App Dev Build - 127.0.0.1:3000, local only.

Reverse Proxy - xpoz.cc => 127.0.0.1:1337

a. System environment:

OS - Ubuntu 18.04.6 LTS

b. Command:

caddy start

c. Service/unit/compose file:

N/A

d. My complete Caddyfile or JSON config:

{
	debug
}
xpoz.cc {
	reverse_proxy localhost:1337
}

3. The problem I’m having:

I’m trying to make a development build of the Playground (It is a React App that is used for testing custom commands & hooks) for CSMM (A web based server manager for 7 Days To Die).

The dev build is hooked up to a pm2 instance of CSMM running on my computer and everything is working fine apart from getting data from the API from the dev build of the Playground.

I’m getting no data back from performing a GET request due to the redirect from the reverse proxy.

Here is the data I am getting from the Network tab of the Chrome Dev Tools after loading the Variables page of the Playground on https://xpoz.cc:

{"variables":[{"createdAt":1648681377391,"updatedAt":1649315757593,"id":62,"name":"exchange:rate","value":"\"0.05\"","server":1},{"createdAt":1648681377413,"updatedAt":1649315757605,"id":63,"name":"exchange:max","value":"100000","server":1},{"createdAt":1648886783818,"updatedAt":1649019065269,"id":82,"name":"player:exchange:uses:76561198382226860","value":"12","server":1},{"createdAt":1648886783844,"updatedAt":1649318113602,"id":84,"name":"player:exchange:total:76561198382226860","value":"0","server":1},{"createdAt":1648900273280,"updatedAt":1648904812527,"id":86,"name":"player:exchange:uses:76561198090571753","value":"24","server":1},{"createdAt":1648900273307,"updatedAt":1649158154144,"id":88,"name":"player:exchange:total:76561198090571753","value":"600000","server":1},{"createdAt":1649018115167,"updatedAt":1649318103602,"id":93,"name":"player:exchange:deposit:76561198382226860","value":"15625","server":1},{"createdAt":1649023174856,"updatedAt":1649318101260,"id":95,"name":"player:exchange:stats:uses:76561198382226860","value":"37","server":1},{"createdAt":1649028129375,"updatedAt":1649318112564,"id":106,"name":"player:exchange:stats:total-deposited:76561198382226860","value":"1715625","server":1},{"createdAt":1649150842315,"updatedAt":1649315757618,"id":109,"name":"exchange:lockout","value":"60000","server":1},{"createdAt":1649152593831,"updatedAt":1649318113622,"id":111,"name":"player:exchange:lockout:76561198382226860","value":"\"2022-04-07T07:56:13.585Z\"","server":1},{"createdAt":1649153001534,"updatedAt":1649158153951,"id":113,"name":"player:exchange:deposit:76561198090571753","value":"20000","server":1},{"createdAt":1649153001564,"updatedAt":1649158147111,"id":114,"name":"player:exchange:lockout:76561198090571753","value":"\"2022-04-05T11:30:07.098Z\"","server":1},{"createdAt":1649153001596,"updatedAt":1649158147100,"id":115,"name":"player:exchange:stats:uses:76561198090571753","value":"12","server":1},{"createdAt":1649153001618,"updatedAt":1649158158332,"id":116,"name":"player:exchange:stats:total-deposited:76561198090571753","value":"640000","server":1},{"createdAt":1649153280911,"updatedAt":1649153280919,"id":117,"name":"player:exchange:setup:76561198090571753","value":"\"true\"","server":1},{"createdAt":1649154287541,"updatedAt":1649154287548,"id":118,"name":"player:exchange:setup:76561198382226860","value":"\"true\"","server":1},{"createdAt":1649315541796,"updatedAt":1649315541802,"id":119,"name":"player:exchange:setup:76561198127885991","value":"\"true\"","server":1},{"createdAt":1649315541813,"updatedAt":1649315785410,"id":120,"name":"player:exchange:deposit:76561198127885991","value":"20000","server":1},{"createdAt":1649315541829,"updatedAt":1649315790887,"id":121,"name":"player:exchange:total:76561198127885991","value":"0","server":1},{"createdAt":1649315541845,"updatedAt":1649315790910,"id":122,"name":"player:exchange:lockout:76561198127885991","value":"\"2022-04-07T07:17:30.868Z\"","server":1},{"createdAt":1649315541857,"updatedAt":1649315778538,"id":123,"name":"player:exchange:stats:uses:76561198127885991","value":"3","server":1},{"createdAt":1649315541872,"updatedAt":1649315789845,"id":124,"name":"player:exchange:stats:total-deposited:76561198127885991","value":"300000","server":1}]}

When I open the Network tab of the Chrome Dev Tools and the same page on the dev build of the Playground I get no data at all. Only a message saying the following:

Failed to load response data: No content available because this request was redirected.

How would I go about making it so that the dev build of the Playground gets the data?

4. Error messages and/or full log output:

There isn’t any error messages.

5. What I already tried:

I’ve spent ages trying to workout how to forward the data but I’m really new to Caddy and Web Dev in general and have no idea how to do it. Any help would be greatly appreciated.

6. Links to relevant resources:

I don’t recommend using caddy start, because it’s not a reliable way to run Caddy. It won’t be restarted if your machine restarts, and you also lose Caddy’s logs, since they don’t get sent to a journal.

I strongly recommend running Caddy as a systemd service, especially if it’s for a long-running/permanent setup. If you installed Caddy with the apt repo, it should already be set up. If not, see the docs for instructions.

Using a browser to debug this isn’t ideal. Look at Caddy’s logs, and use curl -v to see what you’re getting back.

If your upstream is triggering a redirect, then you’ll need to find out why it’s redirecting. Look at the Location header of the redirect response, it should indicate where it’s trying to redirect to.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.