You want to use the. Htaccess file to implement the service that accesses the specified port when there is' API 'in the path
The type is the same as nginx:
location /api/ {
proxy_pass http://localhost:8385;
}
CodePudding user response:
In .htaccess
you would need to use mod_rewrite in order to send the request through mod_proxy. The following is the equivalent of the Nginx config as posted:
RewriteEngine On
RewriteRule ^api/ http://localhost:8385%{REQUEST_URI} [P]
However, you will likely need access to the server config in order to ensure that mod_proxy (and associated modules are installed).
And, if you have access to the server config, then it would be preferable to do this in the main server config to begin with. For example:
ProxyPass /api/ http://localhost:8385/api/
ProxyPassReverse /api/ http://localhost:8385/api/