Trying to mask url / make it shorter

1. The problem I’m having:

Trying to mask url, im using caddy as reverse proxy for oracle apex app.

So this works normaly like this and i can access my app with url like example.com/ords/r/ws/app/login

Thing is this part is always gonna be same example.com/ords/r/ws/app/ but part after like login or home is dynamic url and im trying to mask url or make it shorter like example.com/login to lead to example.com/ords/r/ws/app/login in background.

Tried to reverse proxy like
reverse_proxy 127.0.0.1:8080/ords/r/ws/app/ but the app itself doesn’t work like that, also tried using strip_prefix but i feel thats wrong to use.

So im out of ideas what i can try.

2. Error messages and/or full log output:

Not sure what’s proper syntax for this so im gonna skip

3. Caddy version:

v2.10.0 h1:fonubSaQKF1YANl8TXqGcn4IbIRUDdfAkpcsfI/vX5U=

4. How I installed and ran Caddy:

Running binary from github

a. System environment:

OS: Oracle Linux 9.6
ARCH: amd64

Run caddy as systemd service

b. Command:

systemctl start caddy

d. My complete Caddy config:

example.com {
    reverse_proxy 127.0.0.1:8080
}

You probably want one of these:

For example:

:80 {
	reverse_proxy 127.0.0.1:8080 {
		rewrite /ords/r/ws/app{uri}
	}
}

:8080 {
	respond "Backend will see: {uri}"
}
$ curl http://localhost
Backend will see: /ords/r/ws/app/

$ curl http://localhost/login
Backend will see: /ords/r/ws/app/login

Adjust to your needs.

2 Likes

This indeed does what i asked for now got different issue (could be on ords end not exactly caddy) but location is returning what i need so marked it as answer, thank you!

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