Disabling url escaping, proxy special url

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

Your best option will probably be to write a custom module to do this.

looks lame and overcomplicated.

made a lightweight wrap on a node, works

Plugins for Caddy are very simple to write:

It’s very easy to write
Very easy to install
Very easy to recompile after each change…

In the repository above there is only one small file for 40 lines of code

Almost every first line is useful logic

I didn’t find this kind of expressiveness in the example documentation above

Sorry, I think I will come back to this topic, but so far my solution was the fastest and most efficient for me (same runtime, no need to know the language we don’t use anywhere else, no unnecessary compilations)

But caddy is not bad

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