Question about Caddy Server capabilities


(Rajinder Singh) #1

I am new to CaddyServer.

I have been asked to implement a simple reverse proxy in AWS Ec2 Ubuntu VM.
Client requests will come to AWS ALB. SSL is terminated in ALB
It will do path based routing and forward request to ubuntu server running caddy server.

I want caddy server to be able to map incoming url to new external site.
so I will need to map to a new site and also update part of the path as some below.

for example:
Incoming request:
http://www.site1.com/es-mx/page1/subpage.aspx
should be mapped to
http://www.site2.com/en-us/page1/subpage.aspx

In above example I changed www.site1.com to www.site2.com
I also changed es-mx to en-us

http://www.site1.com/es-mx/page2/subpage.aspx
should be mapped to
https://www.site2.com/en-us/page2/subpage.aspx

I want to set this up manually first.
Once it is setup I want to automate the process of adding rules to the Caddyfile.

Before I spend time looking into documentation I was hoping somebody can tell me if this can be implemented with Caddy.

Thanks


(Matthew Fay) #2

Hi @Rajinder_Singh, Caddy can definitely handle this.

You’ll need to make use of the rewrite and proxy directives. Use a regex to rewrite /es-mx/ to /en-us/, and a standard proxy (transparent preset might be useful?) to forward the traffic to the second site.

https://caddyserver.com/docs/rewrite
https://caddyserver.com/docs/proxy


(system) #3

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