I have apache running(port 443) and i have my node api running(port 2000). and my ssl isn’t a wild card.
My Problem:
i’m getting mix content error on UI cause i’m trying to call my api using http since i don’t have wild card ssl,i cannot create a sub domain and proxy pass to my api. how can i redirect traffic using apache to my api base on the url
URL : http://example.com:2000/api/v1/category/get-all
all my endpoints have /api/v1/ common
Answer
Reverse proxy is what you’re looking for.
https://httpd.apache.org/docs/2.2/rewrite/proxy.html
Basic Example:
RewriteEngine on
RewriteRule ^/api/v1/(.*) http://localhost:2000/api/v1/$1 [P,L]
ProxyPassReverse /api/v1/ http://localhost:2000/api/v1/
This will basically just take any request that comes in for /api/v1/* and proxy it to port 2000 locally with the same URL.
Attribution
Source : Link , Question Author : Frodo , Answer Author : Jason Floyd