Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    HaProxy Rewrite Subfolder to Root

    Scheduled Pinned Locked Moved Cache/Proxy
    7 Posts 3 Posters 2.9k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • SoloamS Offline
      Soloam
      last edited by

      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

      P 1 Reply Last reply Reply Quote 0
      • P Offline
        PiBa @Soloam
        last edited by

        @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?

        1 Reply Last reply Reply Quote 0
        • SoloamS Offline
          Soloam
          last edited by

          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

          GertjanG 1 Reply Last reply Reply Quote 0
          • GertjanG Offline
            Gertjan @Soloam
            last edited by

            @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.

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            1 Reply Last reply Reply Quote 0
            • SoloamS Offline
              Soloam
              last edited by

              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....

              1 Reply Last reply Reply Quote 0
              • P Offline
                PiBa
                last edited by

                @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..

                1 Reply Last reply Reply Quote 0
                • SoloamS Offline
                  Soloam
                  last edited by

                  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.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.