HAPROXY redirection to specific subdirectory on specific port
-
hello all,
i'm looking for help plz in configuring my following scenario on pfsens with HAProxy.
now, i'm running my domain1 with acme ssl & using HAProxy,
https://domain1:443 ==> http://192.168.1.13:80
everything is fine and the domain1 is working on https.now, i need to run an new service on the same domain1 on port 8080 to a specific path:
http://192.168.1.13.com:8080/subfolder1/subfolder2from outside, the users will request the new service on:
https://domain1.com (on 443 of course)i have prepared another domain name (domain2.com) trying to run the above scenario...got blue and nothing worked with me to run the new service on another port with a specific path...!!
can i find help here :(
thanks in advanced.
-
@thefalcon79 said in HAPROXY redirection to specific subdirectory on specific port:
from outside, the users will request the new service on:
https://domain1.com (on 443 of course)Do you mean domain2.com there?
Does it work without the specific path?
Steve
-
@stephenw10
yes, i just made it to try another way to access my internal path (http://192.168.1.13.com:8080/subfolder1/subfolder2) from out side far away from (https://domain1:443)i miss something in settings backend, i guess!
-
@thefalcon79
So you want to enter https://domain2.com in the browser and want HAproxy to call http://192.168.1.13:8080/subfolder1/subfolder2?Yes, this would be possible.
You can set the backend to go to 192.168.1.13:8080 and let HAproxy insert the path.So I guess, the paths should be inserted into every request?
E.g. https://domain2.com/file.html > http://192.168.1.13:8080/subfolder1/subfolder2/file.html -
@viragomann yes exactly that's what i need.
"and let HAproxy insert the path."
i did tried with that, but it doesn't worked with me!@viragomann said in HAPROXY redirection to specific subdirectory on specific port:
So I guess, the paths should be inserted into every request?
E.g. https://domain2.com/file.html > http://192.168.1.13:8080/subfolder1/subfolder2/file.htmli didn't got you in this,
Do you mean modifying the index file?@viragomann said in HAPROXY redirection to specific subdirectory on specific port:
and let HAproxy insert the path.
-
a screenshots of my BackEnd config. :
-
@thefalcon79 said in HAPROXY redirection to specific subdirectory on specific port:
Do you mean modifying the index file?
No I mean, that HAproxy just keeps the requests file, which is, what you want to achieve, I think.
The request path mostly ends with a file (/subdir1/subdir2/file.ext). If you don't state a file, the webserver provides a default file, which can be index.html or default.aspx or any other. This is usually preset, but can be changed in the server settings.To achieve this for any file
https://domain2.com/file.html > http://192.168.1.13:8080/subfolder1/subfolder2/file.html
in the backend use the "http-request set-path" method and enter "/subfolder1/subfolder2%[path]" below.
There is no need to configure an ACL if this should be applied to any request going to this backend. -
@viragomann thank you for your help, appreciate it.
this is what i have configured, but still not going to the path !
what did i missed !
-
@thefalcon79
You have to state this as action.http-request set-path
fmt:/subfolder1/subfolder2%[path] -
@viragomann
i tried both, at Backend pass thru & as Action,
and still getting:
PAGE NOT FOUND
The page you requested cannot be found
or the browser just keep looping with no result!which one is the correct typing:
http-request set-path moheclient/api/emis/getAllTasks%[path]
or
http-request set-path /moheclient/api/emis/getAllTasks/%[path]the url:
http://192.168.1.13.com:8080/subfolder1/subfolder2
is working fine inside my lan. -
@thefalcon79
The path begins with a "/". Hence if you exchange the path with something else, you have also use a slash in the first position.If the browser loops, I assume, that the webserver give a path back to the client to request.
Note, that the suggested method insert "/subfolder1/subfolder2" at the beginning of the path. This is, what I understand, that you want.
But maybe you need something different.
You can use the browsers diagnostic function (F12) to investigate, what it request, if you are unsure, what your backend server does. -
@viragomann i do really appreciate your help
finally it worked for me.
my problem was in the port 8080 with TomCat apache, i just changed the port to 8081, reboot the server, and its worked.by the way, it's working on both as Action & Backend pass thru just fine
again, thanks a lot @viragomann