Keep port in url when usung redirect in Zend Framework - redirect

I have a Windows development machine with an Ubuntu VM set up via vagrant. The VM has Nginx running on port 80 and the Vagrant configuration maps port 8080 on the host Windows machine to port 80 on the VM. For various reasons the project that I'm working uses 127.0.0.1 instead of localhost so, in my browser on the Windows machine, I hit a URL such as:
http://127.0.0.1:8080/foo/bar/baz
The application on the VM is built with Zend Framework 1.12.
If I click a link that has an href="/foo/bar/baz" then all is fine and I go to:
http://127.0.0.1:8080/foo/bar/baz
However, if in one of my controllers I use a redirect to "/foo/bar/baz" then the browser loads:
http://127.0.0.1/foo/bar/baz - i.e without the port in it.
If I then manually edit the URL in the browser's address bar to add the port and hit enter then the page comes up correctly.
I've tried various ways of doing the redirect programatically in ZF, and even tried typing a hard coded URL into the code, but whatever I do it always strips out the port component when the redirect takes place.
Any ideas/suggestions as to how to keep the port in the redirect would be much appreciated.

Related

Expose Ngrok Web interface in same LAN

I have some issue to configurate Ngrok.
I have installed the Ngrok on linux CentOS server dedicated (IP 192.168.1.124), it works correctly the tunneling is ok.
My question is: how i can reach the web page on 127.0.0.1:4040 in order to check the traffic on my Ngrok server?
The web interface page is only accessible on the server where ngrok is running, but if this is a linux minimal server (without gui and any type of browser) I can't see it.
is there a way to make it accessible also in LAN?
e.g. I have another client that can reach the IP where ngrok is running but if i put on web browser http:\192.168.1.124:4040 nothing is showing.
I see from netstat that this port is not listening so isn't a firewall problem or other.
Is possible to change config of Ngrok? otherwise are there other possibilities ? do i have to use a reverse proxy or something like?
Any ideas?
thanks for your help,
Luca
Locate your ngrok's config file:
$ ngrok config check
Valid configuration file at /home/youruser/.config/ngrok/ngrok.yml
Add to the config file the following line:
web_addr: 192.168.1.124:4040
In case you want to expose it to all interfaces, you can replace that value with 0.0.0.0:4040

Install pwa in smartphone with localhost

I have a pwa and with localhost I can install on desktop, but I can't with my samrtphone andorid. Is it possible install a pwa without upload in a http server?
UPDATE:
I founded a work around that works, I putted a server on a port on my android smartphone using Dory - node.js (I have installed also express package)
https://play.google.com/store/apps/details?id=io.tempage.dorynode
Opening chrome in that port I see the "add to home screen popup".
This is unfortunately not an entire solution but an advice on where to look:
Make sure you are in the same wifi network with your Desktop and your phone.
Find out the local IP address of the Desktop PC (probably something like 192.168.0.x). You can find it under ipconfig (Windows) or ifconfig (Unix)
Host your PWA with the http server (remember to use ssl)
Try to access your hosted website from the phones browser, using the IP address and the port, probably something like 192.168.0.x:8080
If you serve your web page through another port (ex. 3000) make sure you configure Port Forwarding through your Router default config IP address
You should be able to open the website. So far I was not able to call the install event, but I will update my answer if I find out more.

Domain Name Instead of Localhost In Eclipse

I've got a tomcat server instance running inside of eclipse. By default it uses a hostname similar to http://localhost:8080/MyApp/ is there some way to proxy this so I can use a domain name like http://example.com/ instead?
On the production server I use apache to proxy the request to point to the tomcat instance, but within eclipse I don't have that luxury.
I'm using Ubuntu. I thought maybe I could map the domain to point to the localhost version in /etc/hosts but that seems to only be the first step. From there I can't figure out how to point the domain to the tomcat url.
Add this to your hosts file, to access via domain name : localhost example.com
Now, You have couple of options :
Host file doesn't know about ports. You have to access your app like http://example.com:8080/MyApp
You can change your tomcat port 8080 to 80 so that you dont have to access it via port like this http://example.com/MyApp
To access your web application via http://example.com, you have to deploy your application in tomcat root. For that refer Deploying my application at the root in Tomcat

Angular app not working in IE 9 on remote server

I have a simple angular application that works just fine when deployed on my local JBoss instance, but when I deploy the same war file in our sandboxed environment (also JBoss) the application doesn't load. Just shows up as a blank page. When viewed on Chrome or FF it works fine as well.
Not a lot to go on, but any pointers in the right direction would be very helpful.
Edit: Just another piece of info, it doesn't work locally on IE either when the address contains the computer name and not localhost. So http://localhost:8080/angularapp works but http://[machinename]:8080/angularapp does not.
In the post you don't make completely clear in what environments you've the problem (it's clear it doesn't work using IE, but does it work in all cases with Chrome and FF?).
But the problem you're experiencing when trying to access using the machine name (http://machinename:8080/...), may be caused because you've not defined properly the IP bindings in the JBoss startup: by default JBoss binds only to localhost (127.0.0.1), if you want JBoss to be accessed from any other network interface, you've to define it. That can be done using the -b parameter of the startup script (run.sh for Jboss 3.x/4.x/5.x/6.x or standalone.sh if it's JBoss 7). For example:
./run.sh -b xxx.xxx.xxx.xxx (where xxx.xxx.xxx.xxx is your server IP) will make the JBoss accessible only from that IP (and its corresponding machine name, provided is correctly defined in the DNS or /etc/hosts ...), but not from localhost.
./run.sh -b 0.0.0.0 will make the JBoss accessible from all the networks interfaces of your server.

How to access JBOSS Restful web service using IP and Port

I created a test JBOSS web service and there is only one test method in it. I access this using http://localhost:8070/MyWebService/MyRESTApplication
and it shows the result from the web service. I tried this in both Eclipse and Browser and it works.
But when i want to access this web service using IP address of my system then it shows ERROR message that Page cannot be displayed (in fact browser is not able to find this web service).
I want to access like this http://IPaddress:8070/MyWebService/MyRESTApplication
what should i do so that i can access it using my IP from some computer
You have to start JBoss using :
./run.sh -b [your_IPaddress]
On windows:
start run.bat -b 0.0.0.0
This will tell it to start and bind to all network interfaces. You can also replace 0.0.0.0 with your actual IP if you only want it to bind to that network interface.
I find it easier for debugging to have it come up on all network interfaces because this will work when you are running a virtual machine to debug something like Internet Explorer.
Open your server setting in Eclipse and set Host name as your IP address or 0.0.0.0