HaProxy Rewrite Subfolder to Root
-
Hello all, is it possible to rewrite a request in HaProxy from subfolder to root?
https://mydomin.com/media/ => https://media.local:2020 (or) http://192.168.1.10:2020
Thank You
-
@soloam
yes you can rewrite a request, but no you cannot change the body of the reply that might contain absolute links to the wrong path.. why not use a subdomain 'media.mydomain.com' and point that to the local webserver? -
I would prefere the path system because I can't use a self signed certificate for this services (not even lets encrypt certificates), and a widcard certificate is very expensive...
Can any one help me with the rewrite rule? To test it out
Thank You
-
@soloam said in HaProxy Rewrite Subfolder to Root:
(not even lets encrypt certificates)
I don't get it - LE certs are accepted worldwide now. Even by IE6 probably.
@soloam said in HaProxy Rewrite Subfolder to Root:
and a widcard certificate is very expensive...
Just got one from LE, free of course.
-
I what to use it with a google assistant test app, and I've had some problems with that certificates... I search around and seen some info that Google does not "like" them to actions app's... i got one (buy) and tested it, and now works... coincidence? Maybe... I don't know... but now I have instructions from the customer to use this certificate....
-
@soloam
Okay so you cant use subdomains..What about using the same path on the servers?:
https://mydomin.com/media/ => https://media.local:2020/media/ (or) http://192.168.1.10:2020/media/That also would avoid most of the rewriting troubles.. Only thing thats left would be to point the right path to the proper backend server. But that should be easy..
acl media_acl path_beg /media/ use_backend media_bck if media_acl
Or its similar gui options..
-
That is the solution that gives me a lot of troubles... When I point https://mydomin.com/media/ => https://media.local:2020/media/ I have to configure media.local to have a service running on a different path, and that brings a lot of problems. The easyest solution would be to mask the url and rewrite https://mydomin.com/media/ to https://media.local:2020 that way I don't need to mess with the destinations servers.