Skip to content

Apache rerouting

Edwin van den Belt edited this page Jun 17, 2020 · 1 revision

To facilitate one endpoint to operate on with multiple versions, I had to implement a rerouting mechanism. On the server itself there are running multiple SpringBoot applications, all on there own port.

I use apache in front of all these applications and used the rewrite module to reroute the messages to the handling application. Therefore I had to add in the site configuration file of apache these lines:

RewriteEngine on
RewriteCond %{HTTP:Api-Version} "=0.5.0" [NC]
RewriteRule ^/bike/(.*) http://localhost:8052/$1 [P]

RewriteCond %{HTTP:Api-Version} "=0.6.0" [NC]
RewriteRule ^/bike/(.*) http://localhost:8062/$1 [P]

These rewrites do check the available header line and reroute it to the appropriate port.

Clone this wiki locally