I have read this question, I found the best answer for me was : http://ngrok.com small tool
This tool is really great, but to add a custom domain you need paying plans
Is there any other tool like Ngrok to Access XAMPP Localhost from Internet
There npm module localtunnel.me which allows you to specify custom subdomain.
npm install -g localtunnel
then start tunnel like this
lt --port 8000 --subdomain yoursubdomain
then you'll be able to access it like subdomain.localtunnel.me
Related
I'm trying to share the port 443 from my development machine (win10) to my laptop (os x) using the amazing Live Share feature of Visual Studio Code.
On the dev machine I can access the service (running behind an nginx reverse proxy), so server is running fine.
VS Code doc mention a 1:1 mapping for the port "unless it's already in use".
Checking with sudo lsof -P -i TCP -s TCP:LISTEN on the mac, I can confirm 443 is not in use.
But the port on the mac is mapped to a random port (50150 in this case) instead of 443.
I guess I'm lacking some rights to open a sub 1000 port on os x.
Does anyone know what I can do (I mean other then running vscode as root)
Thanks
Short answer (for anyone who would find this later) : not possible!
Restricted ports are ... restricted.
And as I said in the question i don't want to run vscode as root.
But what I ok to run as root is a small utility to do port forwarding.
So I'm now using portforward (npm -> https://www.npmjs.com/package/portforward ) to do just that, and everything works fine.
I need to use cumulocity behind the proxy server. Therefore, I have set the proxy addresses using: "npm set proxy" and "npm set https-proxy". Now I am able to run a standard angular project and it works fine.
But when I create a c8y project and run it using "c8ycli server -u ...", I get this error by each request:
[HPM] Error occurred while trying to proxy request /tenant/loginOptions from localhost:9000 to https://....com (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
Does c8ycli use npm proxy settings? How can I set proxy address for c8ycli?
I think it has nothing to do with c8y itself. You should try setting the proxy manually with npm:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Taken from here
Hope this help!
Edit:
Checking at the c8y tool (/usr/local/lib/node_modules/cumulocity-tools in my case) I notice they are using express (lib/devserver/server.js) when you run the server command. In that file they use their own proxy (lib/devserver/proxy.js) settings to resolve the localhost to the tenant's url.
As they are using express I think you can change those file to set you proxy configurations. I have not much experience with express but I found some information searching
express behind-proxies
nodejs-express-why-should-i-use-app-enabletrust-proxy
using-app-set-to-set-trust-proxy
Good luck!
I have written an app in ruby using sinatra. the app works fine and I am testing the post/get request using postman.
Right now I start the app using the command rackup but it starts the server locally on the port 9292. using postman, I send the POST on localhost:9292
I would like to test the app when access from another computer. I expect something using POSTMAN sending a POST on http://182.12.34.1:9292 but I didn't find how to do this.
config.ru
load './app/init.rb'
run Sinatra::Application
Procfile
web: bundle exec unicorn -p $PORT -E $RACK_ENV -c ./config/unicorn.rb
Any idea, how to switch from local test to a server ?
Thansks
The easiest way is to use an existing tool like ngrok or localtunnel.
If you have npm installed, then you can do this in a new terminal:
sudo npm install -g localtunnel
lt --port 9292
It will then give you a URL that you can share. Keep in mind these two things:
The URL is only valid as long as the localtunnel process is running
You still need to have your server running on localhost:9292 for it to work.
Did you perhaps listen to localhost only in the config?
You need to bind the host to 0.0.0.0 otherwise it will only only be available locally...
I have uploaded a laravel site on live server and now I wanted to install a library like MailChimp. On local server I do it using composer but I want to do it on live server where the site is hosted and running . How to
install dependency and connect to hosting server using command line. Is it possible to access the hosting server file using DOS etc and run composer.
Well you can connect to the server through ssh and have access to the command line but it depends on the server, you might have the rights to install other programms or you may not...to get your hands on composer and install new dependencies you probably need to have those rights to install.
What type of server you have...VPS or Shared host. Probably on a VPS you can set up ssh connection...on a shared host things depend on what they have allowed you to have access to.
I'm installing Meteor (framework) on my AWS EC2 (micro) instance and followed the instructions and after creating a test project I ran meteor on that directory giving me the expected
[[[[[ /var/www/html/meteortest ]]]]]
Running on: http://localhost:3000/
But I can't navigate to my server's localhost in my browser to see the hello world example project. Is there a way I can make meteor work on something like :
http://mydomain.com/meteortest/
or
http://mydomain.com/meteortest:3000
The way that Meteor sets the ROOT URL is by using an environment variable called ROOT_URL:
http://docs.meteor.com/#meteor_absoluteurl
So you could run your Meteor instance like so: ROOT_URL="http://mydomain.com/" meteor --port 80
However, if you want to have the meteor instance served from a folder (like http://mydomain.com/meteortest), you will have to use nginx to forward ports (see Tyr's example) but replace the line:
location / {
with:
location /meteortest {
and change your ROOT_URL appropriately. If you still can't access your domain from outside, you may have not set your security groups properly for EC2. You have to open up port 80. More information on how to do this can be here: http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/using-network-security.html
You can setup nginx to proxy port 3000 to your domain. Something like:
server {
listen 80;
server_name meteortest.mydomain.com;
access_log /var/log/nginx/meteortest.access.log;
error_log /var/log/nginx/tmeteortest.error.log;
location / {
proxy_pass http://localhost:3000;
include /etc/nginx/proxy_params;
}
}
Please see http://wiki.nginx.org/HttpProxyModule for more information.
However, running meteor on port 3000 is a development environment. If you want to use it in production, please run "meteor bundle", and then follow the README inside the generated tarball.
I think the problem is that port 3000 is likely blocked by amazon's firewall. You could look at opening it up, try Tyr's solution, or try just running meteor with
meteor --port 80
You may need root permissions (i.e. sudo) to do this.
Running directly on port 80 would require root privileges, which you don't really want your web server to run as -- starting it as root and deescalating to a regular user is possible, but not really ideal as well, as you may find that a programming bug at some time forgets to deescalate privs and you will not see any errors from that.
In many cases, I don't really want/need to run a load balancer to use multiple core, especially if I'm runnning on AWS single core t1 or t2 instance types, which I just scale out as I need them -- hence the best advice I have seen is to simply use the Linux kernels ability to do port forwarding, mapping port 80 to port 3000, like this
$ sudo iptables -A PREROUTING -t nat -i eth0 -p tcp \
--dport 80 -j REDIRECT --to-port 3000
Nice and easy and nothing else to do -- and super efficient at the same time as no extra processes are involved in serving the requests.