so I’ve got everything working (Apache/NodeJS/framework7) locally only I wanted to access my app within my own network via 192.168.x.x. I set up access via Apache ServerAlias and it does let me see the app on desktop.
I only get this error when accessing via IP on mobile. (Also on desktop)
GET http://192.168.2.21/packages/core/css/framework7.bundle.min.css net::ERR_ABORTED 404 (Not Found) GET http://192.168.2.21/packages/core/js/framework7.bundle.min.js net::ERR_ABORTED 404 (Not Found)
I guess it is somehow looking in the wrong folder? But I am not sure why, I don’t really have much experience with node.
For some reason it also fails to load a font in a css file, but I am also loading images from /img in the same css file and they work fine? GET http://192.168.2.21/fonts/exo/Exo-Regular.tff net::ERR_ABORTED 404 (Not Found)
So http://localhost:3000/node-app/ works. But http://192.168.2.21/ doesn't work, does show the page but no css/js loaded.
Thing is I need to test my app on mobile because it has some mobile-only features, so I have to be able to reach it from the outside.
I have already tried changing some configurations in both Apache and NodeJS but nothing seems to make a difference.
Apache config
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName test.local
ServerAlias 192.168.2.21
DocumentRoot "D:\xampp\htdocs\test\test-app"
<Directory />
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ProxyRequests Off
ProxyPreserveHost On
ProxyVia Full
<Proxy *>
Require all granted
</Proxy>
<Location 192.168.2.21>
ProxyPass http://127.0.0.1:3000
ProxyPassReverse http://127.0.0.1:3000
</Location>
</VirtualHost>
Gulpfile
connect.server({
host: '127.0.0.1',
root: ['./'],
livereload: false,
port: '3000',
});
Folders (not all of it)
test-app
- css
- js
node_modules
packages
- core
scripts
src
gulpfile.js
package.json
Alright turns out I was sort of staring blind on wanting to use Apache for this. My solution right now is just to not use Apache at all.
connect.server({
host: '192.168.2.21',
root: ['./'],
livereload: false,
port: '80',
});
And then I created an index.html in the root that redirect to my app folder.
<meta http-equiv="refresh" content="0; url=/my-app" />
Also note that changing root to ./my-app won't work as I have the packages/src folder in the root folder. This will create the same situation as before.