logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Redirect and doing special things
Author
ThomasT



Joined: 05 Sep 2018
Posts: 8
Location: Germany

PostPosted: Thu 06 Sep '18 13:42    Post subject: Redirect and doing special things Reply with quote

Hi,

although I often used (means devolped something that run in it) apache-webserver I don't have a clue.

I think I descripe what I want to do and hope for tipps.

We want to install a proxy that gets https-request, e.g. for an image. But this request contains a special UUID.

https://myserver/niceimage.jpg?UUID=42

the proxy shall extract (and remove) the uuid and redirect (302) to the actual server providing the requested resources (e.g. https://otherserver/niceimage.jpg).
The uuid shall be written to file or to database or whatever.

The server should be able to process and aswers requests "get all UUIDs you got until now" from outside.

My question how to do this in the most effective way?
I hope its clear what I want. If not, please ask Wink

Regards Thomas
Back to top
mraddi



Joined: 27 Jun 2016
Posts: 149
Location: Schömberg, Baden-Württemberg, Germany

PostPosted: Fri 07 Sep '18 9:10    Post subject: Reply with quote

Hello Thomas,

I would use mod_rewrite on myserver to get all requests containing the UUID rewritten to a php-page (of perl or whatever you prefer).
This php-page writes the UUID to the database (including a check if the UUID is alread there) or simply append it to a plain-text-file (which can be processed with the linux-tools sort + uniq "cat uuid.txt | sort | uniq") for analysis. And it redirects the user to the new URL.

The "how-to-rewrite-only-requests-with-defined-parameters" can be found here: https://stackoverflow.com/questions/4703476/what-rewriterule-would-be-to-redirect-based-on-the-on-query-string-parameters

There might be other ways containing more magic but I think this is an easy-to-understand-approach - today when implementing it and in some months/years when looking at it and thinking "how did this work?"

Hope this helps? Very Happy

Best regards
Matthias
Back to top
ThomasT



Joined: 05 Sep 2018
Posts: 8
Location: Germany

PostPosted: Thu 13 Sep '18 10:11    Post subject: Reply with quote

I'll try it. Thanks.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Thu 13 Sep '18 15:52    Post subject: Reply with quote

Note that Apache 2.4 can do that even without complex rewrite rules

See https://mariobrandt.de/archives/apache/apache-2-4-disallow-access-to-a-certain-location-if-a-query-string-is-set-952/

if you still have a question please ask again.
Back to top


Reply to topic   Topic: Redirect and doing special things View previous topic :: View next topic
Post new topic   Forum Index -> Apache