1

I have main url like http://apps1.example.com and i want create alias like http://apps1.example.com/svc-base

in my vhost config

<VirtualHost *:80>
 ServerName apps1.example.com

 ProxyPreserveHost On

 ProxyPass / http://123.456.7.8:880/
 ProxyPassReverse / http://123.456.7.8:880/
 
 Alias /svc-base !
 ProxyPass /svc-base http://123.456.7.9:881/

 ProxyRequests     Off
 AllowEncodedSlashes NoDecode
</VirtualHost>

When access from browser the url http://apps1.example.com/svc-base just redirect to main page of http://apps1.example.com/ what's wrong with my code? need advice thanks before :)

Aleh
  • 11
  • 1

1 Answers1

0
Alias /svc-base !

Usage for the Alias directive is:
Alias [URL-path] file-path|directory-path

An exclamation mark ! is, as far as I know, not a valid syntax for the Alias directive (unless you're actually matching to a file/directory named /!).

(Maybe you're confused with the fact that the exclamation mark ! can be used in conjunction with a ProxyPass directive in situations where you don't want to reverse-proxy a subdirectory and exclude a path that would be otherwise matched by a ProxyPass.)

What I think you're trying to achieve though, does not require an Alias anyway.


It appears that you want to ProxyPass /svc-base to a different back-end server than the root URL ProxyPass /.

That is achieved by changing the ordering of the ProxyPass directives, as ProxyPass rules are checked in the order of configuration. The first rule that matches wins. So usually you should sort conflicting ProxyPass rules starting with the longest URLs first.

 ProxyPass /svc-base http://123.456.7.9:881/
 ProxyPassReverse /svc-base http://123.456.7.9:881/ 

 ProxyPass / http://123.456.7.8:880/
 ProxyPassReverse / http://123.456.7.8:880/
diya
  • 1,771
  • 3
  • 14