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

slowkow's avatar

Proxy requests to another app on localhost

Problem Summary

My server runs 2 independent apps:

  1. Laravel for user registration and authentication. This is exposed to the public.

  2. Some other app, let's say a python server. This is only accessible on localhost, but it is not exposed to the public.

Goal: allow authenticated users to view the localhost app via Laravel.

Questions

  • What is the minimum Laravel setup required to get this to work?

  • What should the routes look like?

The request flow looks something like this:

  1. User visits http://example.com/app

  2. Laravel checks if user is authenticated

  3. If user is not authenticated, redirect to http://example.com/login

  4. If user is authenticated, proxy the request to http://localhost:1234/my-app and return the response back to the user.

  5. When the localhost app requests /my-app/resource.jpg Laravel should fetch it from http://localhost:1234/my-app/resource.jpg but the user will see it at http://example.com/app/resource.jpg

0 likes
1 reply

Please or to participate in this conversation.