Hi. I need some help deploying my Phoenix app. I currently build the app using Distillery and serve it using Nginx. There are other non-Phoenix apps being served by Nginx already, so I can’t just serve my app at ‘/’
The static assets are packaged with my app and are not served separately with Nginx.
I am trying to serve my app at http://servername/myapp/
I have Nginx setup to reverse proxy the requests to my Phoenix app. The requests reach the Phoenix app. However, the static assets and links (paths to my controllers) don’t work, because they all request it from the / location, which is then not found.
Note that when I start up my app, it show “Running HprsLocalAuthWeb.Endpoint with Cowboy using http://:::4000” with no hostname, no matter what I set it to.
Also, when I perform a request at http://servername/myapp, my Phoenix app outputs the following. The GET // is not right:
15:20:53.989 request_id=2kqp9j2rconlnrrnmk000084 [info] GET //
After serving the app, when I modify the html source tag of the JS or CS file in the browser console and prepend ‘/myapp/’ to it, then it finds the files.
How can I get all the paths in my app to prepend the path ‘/myapp/’ to all requests without hardcoding this in the app itself? Or is there another alternative?
Thanks for any assistance!