1. The problem I’m having:
Solve the problem on the caddy:
I need to proxy urls like:
https://page.hyoo.ru/?_escaped_fragment_=%3Diy8wtn_tky6pc
to https://sync.hyoo.ru/land=iy8wtn_tky6pc=(title_text;release_ref(release_blob))
An example of how I would do this in nodejs:
const api = 'http://sync.hyoo.ru/land'
const fastify = require( 'fastify' )( {
logger: true
} )
fastify.get( '/', async ( request, reply ) => {
reply.header( "Content-Type", "text/html; charset=utf-8" )
const { _escaped_fragment_ } = request.query
if( _escaped_fragment_ ) {
const proxy_request = await fetch(
`${ api }${ decodeURIComponent(_escaped_fragment_) }=(title_text;release_ref(release_blob))`
)
return await proxy_request.text()
}
return null
} )
fastify.listen( { port: 2999 }, ( err, address ) => {
if( err ) throw err
} )
3. Caddy version:
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=
4. How I installed and ran Caddy:
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
a. System environment:
debian lts, no docker