AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Redirect ip to localhost mac3/20/2024 ![]() Thanks to for this clever hack! TLS/SSLįirst, you need to make sure that openssl is installed correctly, and you have key.pem and cert.pem files. To implement a catch-all redirect, use the index page itself as the proxy with: http-server -proxy Note the ? at the end of the proxy URL. This can be used for Single-Page App (SPA) hosting to serve the entry page. 404.html will be served if a file is not found.index.html will be served as the default file to any directory requests.types file for custom mimetype definition We can’t do this with the hosts file, because that can only redirect a server name to an IP address (the opposite way round to what we want here). e.g.: cure falseĮnable secure request serving with TLS/SSL (HTTPS)Īutomatically provide a /robots.txt (The content of which defaults to User-agent: *\nDisallow: /) Pass proxy options using nested dotted objects. Proxies all requests which can't be resolved locally to the given url. To disable caching, use -c-1.Įnable logging of the client's IP address Set cache time (in seconds) for cache-control max-age header, e.g. Open browser window after starting the server. If gzip is also enabled, it will try to serve brotli first.Įnable CORS via the Access-Control-Allow-Origin header public/some-file.js when a brotli compressed version of the file exists and the request accepts br encoding. Router IP 192.168.1.1 Macbook IP 192.168.1.231 Firewall: off ping works on: localhost, 127.0.0.1, 192.168.1.1 (router), 192.168.1. I have a vhost folder in my Sites folder, and I have a list of folders, such as: recipes.cam database.cam sandbox.cam codeigniter. ![]() So I've set up virtual hosts for my Mac and I do all my development locally on my computer. The answer might be out there, but I can't find it. I want to redirect this request to localhost somehow so that program X is really doing a request to localhost:8000. 7 I'm not even 100 sure how to ask this question. If brotli is also enabled, it will try to serve brotli first. I have program X on my mac which makes a request to 10.96.232.120:30323 through UDP. public/some-file.js when a gzipped version of the file exists and the request accepts gzip encoding. Use -p 0 to look for an open port, starting at 8080. Add -c-1 as an option to disable caching. Globally via Homebrew brew install http-serverĪs a dependency in your npm package: npm install http-server This will install http-server globally so that it may be run from the command line anywhere. It will be something along the lines of '192.168.1.100'. Look for either 'en0' or 'en1', and under that entry look for the 'inet' listing. The most general way of finding this info, which works on both Mac and Linux, is to go into the Terminal and type ifconfig. Globally via npm npm install -global http-server To access it on your Android, you need to find the computers IP address. Using npx you can run the script without installing it first: npx http-server It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development and learning. Http-server is a simple, zero-configuration command-line static HTTP server.
0 Comments
Read More
Leave a Reply. |