0

I have this situation. Current VM where this nginx config is stored has a valid ssl certificate. Inside this VM is the main application app1 served in port 80. On another port 1234 another service is served app2 in a docker container. I managed to reverse proxy app2 like this

       location /app2/ {
           proxy_pass          http://127.0.0.1:1234/;

           proxy_http_version 1.1;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection "upgrade";
           proxy_read_timeout 600s;

           proxy_redirect    http://127.0.0.1:3888/ http://127.0.0.1:8080/vnc/;
           proxy_set_header  Host             $http_host;
           proxy_set_header  X-Real-IP        $remote_addr;
           proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
           proxy_set_header  X-Forwarded-Protocol $scheme;
       }

app2 can be accessed by https://mywebsite.com/app2

Now I have a Laravel app in another VM app3 (not in a docker container). I did the same procedure. When I go to https://websited.com/app3 it only loads the html part but not javascript and css. The error on mozilla console shows as

Blocked loading mixed active content “http://mywebsite.com/css/style.css”

As I understand it should look inside the resources of the VM that app3 is stored. How do I make the nginx to load app3 resources like js and css?

llesh
  • 1
  • You mention `mywebsite.com/app2` and `websited/app3`. Can you clarify what are the exact sites here? Also, if you could provide the output of `nginx -T` in the question, that would be helpful in seeing the full picture. – Tero Kilkanen Jan 30 '23 at 20:13

1 Answers1

1

You need to set the root URL in your Laravel application, so that Laravel generates the correct URLs for the resources it refers to.

https://stackoverflow.com/questions/35304448/laravel-change-base-url has information how to do it.

Tero Kilkanen
  • 36,796
  • 3
  • 41
  • 63
  • Thanks for the suggestion. Unfortunately it still search within current VM for the styling files and javascript. – llesh Jan 29 '23 at 15:19