Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jlrodriguezd81's avatar

Make a tunnel connection between laravel 8 app and an external API

Hello community, I am new here and my Laravel experience is medium, I have a question and I would like to know if you can guide me to have a solution.

I want to make a tunnel connection between a Laravel 8 App and an external API. The API has a rule that only accepts connections from the public IP of the Laravel APP, but this does not work because the requests that are made are made by the user who enters the APP and take the IP of the user and not the Server.

Is there any way to make the requests made by the user do it through the server and that this server makes the request to the external API and recognizes the Public IP of the same.

Greetings and thanks for the support.

Sorry for my English

0 likes
1 reply
rodrigo.pedra's avatar

the requests that are made are made by the user who enters the APP and take the IP of the user and not the Server

Are you making the requests to the external API directly from the frontend?

If you are making it from the backend the IP should be the server's not the client's.

You need to proxy the requests through your server.

Browser --> Your server --> External API

So from your front end you make a request to an endpoint on your bakend, then on this endpoint you request the external API.

On your backend you can use Laravel's HTTP client to make such requests.

https://laravel.com/docs/9.x/http-client

Please or to participate in this conversation.