Page 1 of 1

Easy server proxy?

Posted: Thu Feb 20, 2025 1:01 pm
by Caronte3D
First of all, I don't have much experience with servers of any type :?

What I need is:
Run a server (on a vps), access it from the client web browser, where the client ask for something like: https://myserver.com/test/img.jpg, then the proxy modify that url to: https://anotherserver.com/test/img.jpg?key=APIKEY, and server the result to the client.

What would be the easiest way to do it?

I don't know if PB is enough or I need more... standard tools?

Re: Easy reverse proxy?

Posted: Thu Feb 20, 2025 2:45 pm
by JHPJHP
[REMOVED]: Non PB answer, misunderstood the requirements.

Re: Easy reverse proxy?

Posted: Thu Feb 20, 2025 3:32 pm
by Caronte3D
Hey! JHPJHP :wink:
Thanks! I will wait for more options, but the php seems a good option.
About the .htaccess, I don't know, but... maybe the redirection exposes te apikey on the client browser url bar? :?

Re: Easy reverse proxy?

Posted: Thu Feb 20, 2025 4:32 pm
by JHPJHP
Hi Caronte3D,

Your original question included a QUERY_STRING for the API Key.
It didn't make much sense at the time, but I guess it could have been an enclosed environment.

Would probably be helpful to others if you provide additional details:
• What format is the is the image expected, or is just the image name required as your previous post suggests?
• Otherwise, the server is probably expecting either the full URL to the image or the image converted into Base64.
• Redirecting from a server you control, then a POST request using the Fetch API is an obvious choice.
• Most (API) servers have specific requirements (i.e. expecting JSON).
• I'm assuming you'll be receiving a response, what's the format of the response?

I probably have tunnel-vision; wait for a PB answer:
As I just finished an App that served both an image URL and Base64 image string to a server that required an API Key.
• The API Key was secured, the POST data was JSON encoded, and the response imaged data was also JSON encoded.

Anyways, good luck.

Re: Easy reverse proxy?

Posted: Thu Feb 20, 2025 4:44 pm
by Caronte3D
My example was only a general one (not mine), but if you ask me for more specific...:
For my current project, I need to consume tile maps of this site: https://protomaps.com/api so... the only thing I want to hide, is the apikey for obvious reasons.
In resumen, The apikey must be only in my server where no one can see it.

Re: Easy reverse proxy?

Posted: Thu Feb 20, 2025 9:29 pm
by idle
atomic webserver does tls terminating reverse proxy on windows but only with pb 6.12
so you can run multiple domains on the same machine or other machines behind the nat.
It doesn't work properly on linux though which might have been an issue with the tls lib version or build

but you can easily fetch recourses with atomic webserver too with https requests

Re: Easy reverse proxy?

Posted: Fri Feb 21, 2025 7:08 am
by Caronte3D
idle wrote: Thu Feb 20, 2025 9:29 pm but you can easily fetch recourses with atomic webserver too with https requests
I don't mind if the server needs Windows for this, in fact my first choice was AtomicServer, but I haven't enough skills to do what I need transparently.

Re: Easy server proxy?

Posted: Fri Feb 21, 2025 9:01 pm
by idle
It easy enough to fetch a resource but it also depends on whether you need to parse the return from the api
I sent you an example

Re: Easy server proxy?

Posted: Sun Feb 23, 2025 7:25 am
by idle
I've got it working in atomicwebserver but I can handle it better by changing how URI handlers are implemented
so you can set them by depth so domain/tiles/ will catch any children under it like domain/tiles/z/x/y
it makes more sense plus it's easy to cache them to disk to reduce the overhead of fetching them again.

Re: Easy server proxy?

Posted: Sun Feb 23, 2025 8:44 pm
by Caronte3D
Image