How to fix Meteor base url in NginX reverse proxy configuration?

I installed both Apache and Meteor for NginX through a reverse proxy (on a Ubuntu server). Apache is displayed directly as baseURL (www.mydomain.com/), and Meteor is displayed as a subfolder (www.mydomain.com/live/).

The problem I am facing is that my Meteor test (which works as expected on port 3000) stops working for NginX, since every link (CSS, Javascript, template) is absolute for baseURL.

<html> <head> <link rel="stylesheet" href="/live.css?abc"> <script type="text/javascript" src="/packages/underscore/underscore.js?efg"></script> ... <script type="text/javascript" src="/template.live.js?hij"></script> <script type="text/javascript" src="/live.js?klm"></script> </head> 

Obviously, since Apache is displayed in baseURL, these files are not detected when testing through NginX.

What would be the best way to solve the problem? System administration is not my forte, and Meteor is my first intrusion on server-side javascript. Therefore, I don’t even know if this can be fixed, and if so, if it is done through the server configuration, Meteor configuration or programmatically.


EDIT: The new "absolute url" package in Meteor 0.4.0 fixed the problem!

http://docs.meteor.com/#absoluteurl

+4
source share
2 answers

The new absolute-url package in Meteor 0.4.0 fixed the problem.

http://docs.meteor.com/#absoluteurl

+5
source

Why do you include scripts and styles in your <head> with Meteor? Everything that is included in the catalog of your meteor project, be it js, html or css, will be bundled and sent to the client without being included in your HTML with <link> and <script> .

If you have to include things in your <head> , why not just use the absolute path, including the subfolder?

 <html> <head> <link rel="stylesheet" href="/live/live.css?abc"> <script type="text/javascript" src="/live/packages/underscore/underscore.js?efg"></script> ... <script type="text/javascript" src="/live/template.live.js?hij"></script> <script type="text/javascript" src="/live/live.js?klm"></script> </head> 

Forgive me if I do not understand the problem.

+1
source

Source: https://habr.com/ru/post/1416634/


All Articles