We have a domain name with DNS management facility. We also have a web application developed in a GlassFish server hosted in a virtual server with a path is
http://198.98.103.233:8080/pemis/
I want to direct to the home page of that application when some one type the domain name. After navigating through the pages, we must be able to see
http://www.pemis.lk/faces/public.xhtml
in the browser rather than
http://198.98.103.233:8080/pemis/faces/public.xhtml
How can we configure that.
Thanks in advance.
You need to install your application as the root application in Glassfish, as explained here. But it's not hard:
asadmin deploy --contextroot "/" your-webapp.war
or set the context-root property in the sun-web.xml or glassfish-web.xml depending on the version of Glassfish you use.
To change the port Glassfish listens on you need to modify the HTTP Listener configuration. On default installations you'll want to change http-listener-1's port. You can do so using the console. But you can also directly edit the domain's domain.xml:
<network-listeners>
<network-listener port="80" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
...
</network-listeners>
Last, to make www.pemis.lk point to that server you need a DNS entry that points to the address the server is attached to. The details of how to do that depend on the comapny that sold you the domain, quite often they have online tools that allow you to enter or modify the name-address mapping. In case of doubt it's best to contact them by phone or mail.
I'm on the same path and, as you don't posted the solution that you found (if you found it), I'll add here some future reference for anyone facing this problem.
I'll break the question in two parts: Eliminating host:port and changing how the URL behave.
I don't have a complete response to the first, however if you chose to listen at port 80, by HTML standard, you will supress the port on the URL, getting half the solution you want.
The second part, changing the URL behavior and/or shortening it can be achieved by either using mod_rewrite in apache or Tuckey's URL Rewrite Filter (http://www.tuckey.org/urlrewrite/). A google search using URL Rewrite can achieve you a more in depth explanation and there's a guide on the website.
You should, however, update your question with an answer, if you found one.
Related
Say we have an internal URL https://my.internal.url (in our case a Liferay Portal) and from a web application firewall an external URL https://my.external.url pointing to this internal URL.
The internet user is using the external URL.
PrimeFaces extends attributes like for example
onclick="...;window.open('https://my.interal.url'..."
This leads to CORS problems.
The HTTP header Access-Control-Allow-Origin is not an option, since the internal URL is internal.
We'll talk with the WAF people about URL replacement, but I'd like to know wether or not we can tell PrimeFaces to use the external URL (or maybe relative URLs in case this would work).
The portal doesn't know about the external URL but of course we could implement this as a configuration option.
(watching the source code, there are more occurences of the internal URL outside of the jsf/PrimeFaces portlet, so I add the liferay tag too)
Update
The question is obsolete, WAF has to handle this correctly (an old SSL environment did it, a new WAF environment doesn't)
You say
The portal doesn't know about the external URL
however, any properly configured reverse proxy (or WAF) should forward the actual host name used to request the current page.
On Apache httpd's mod_proxy_http, this is done with the option ProxyPreserveHost On. When forwarding with AJP, the host is automatically forwarded. Other WAF/Proxy configurations - of course - differ. But the proper way to generate the URL is to let the generating server know what URLs it should generate.
If you need to worry about the proper host name, you'll need to do so by request: Liferay is well able to use Virtual Host names to distinguish between different sites - and if they're completely different, you might be signed in to one of them, but not to the other. This has a repercussion on the permissions.
Have the infrastructure handle it for you. Don't write code (or application configuration) for it.
i'm trying to implement CAS in Liferay portal. after setting configurations, when i click on signin button, it redirects me to this url :
https://sso.myuni.ac.com:8443/cas/login?service=https%3A%2F%2Flocalhost%3A8080.
my real hostname is : www.liferay.myuni.com and the port is 8443.
how can i change settings in order to liferay returns real hostname instead of localhost?
i want to liferay returens https://sso.myuni.ac.com:8443/cas/login?service=https%3A%2F%2Fliferay.myuni.com%3A8443
Are you running with an Apache in front of your tomcat (assuming you're using tomcat)? If you do (and if you use mod_proxy to forward the requests), make sure you also include
ProxyPreserveHost On
This will make sure that Tomcat has an idea what the originally requested host name is - otherwise it'll take whatever the Proxyserver sends (when installed on the same server, this is typically localhost).
Read about ProxyPreserveHost
Alternatively, check if you can declare the actual host name in Liferay's configuration, e.g. by searching for localhost in portal.properties (you'll override this in portal-ext.properties)
Edit: As you say you only use tomcat, no Apache: Please state what remote host you're actually seeing instead of the expected (and how you obtain it)
With regards to portal.properties: This is a file that is contained within one of Liferay's jars, and is not meant to be modified (that's why it's not easy to find). However, the HTML version is here, it contains a lot of configuration options. You're overriding by creating a file named portal-ext.properties in ${liferay.home}, containing only those settings that you'd like to change with regards to portal.proerties.
Since I am using a host header filtering technique in my ASP.NET MVC application, I would like to prevent users from browsing directly to the IP address of my site, and force them to use the FQDN. Is this possible?
I see similar SO question here with no answer
You can do this with Bindings in IIS (assuming you're using IIS): https://technet.microsoft.com/en-us/library/cc731692(v=ws.10).aspx
Open IIS
Right click your site
Click "Edit Bindings"
Edit the entries (http/https) to include a "Host Name" (ex. "YourSite.com", "sub.YourSite.com", etc...)
An alternative would be to force a redirect to the FQDN in your code. You should be able to determine the url using a ServerVariable: https://msdn.microsoft.com/en-us/library/system.web.httprequest.servervariables(v=vs.110).aspx
You can add another Website in IIS, locate it to an empty directory to make it don't do anything useful, use 80 port but don't bind any hostnames. In this case, who access your server by IP directly would just hit this Website, they won't bother you anymore.
Or maybe you can put some helpful webpages in this website to help your client visit by domain name correctly.
Here is my issue (keep in mind I am used to linux not windows servers): I have a website domain.com (.asp site) that is hosted on an IIS8 server and then a folder domain.com/folder that needs to point to a different servers IP address that holds a different site (linux server running Magento).
I know personally that a subdomain should have been created and DNS pointed to it correctly like folder.domain.com but I have inherited this issue and am trying to see if a solution is even possible.
Thank you all in advance.
I dont have previlage to comment in your question.! So I commenting here.!
Have you ever crossed symlinks? I hope you need the following link. The question is not clear though.
check this out.
Symlink created with mklink not working with IIS7.5 -- Windows 7
Responding as another team member on this project--
A 301 redirect is not a viable option by nature of Magento's URL request mechanism (if the request didn't originate from the URI set in the config, then redirect to it). We either end up with infinite loops, or IIS rewriting headers to trick Magento in to thinking the request URI is correct and performing a 301 redirect on every resource on the page (and the page itself, of course). This breaks miserably on POST requests.
We must be serving fully-qualified URLs from domain.com/folder/foo-bar.baz.
Switching to Linux is not possible. Please don't suggest what we already want.
Thanks, SO.
This is a fairly simple question (in my opinion) but for some reason despite my Googling I cannot find a straight answer to it.
Currently I have an application running under my Default Web Site located at http://localhost/myApp. Ideally, I'd like to create a new site in IIS with a binding to 127.0.0.1:80 and a host header of http://myApp so that I can test my url rewriting rules properly (since my app will ultimately be hosted at http://www.myApp.com, not http://www.somedomain.com/myApp).
So, my question is this: will the above work? I haven't had a chance to try it yet.
If the above will not work, what are the steps to be able to access my site at http://myApp on my local network?
It should work provided you fool the OS into resolving www.myapp.com to 127.0.0.1. To do so, edit your hosts file in %systemroot%\system32\drivers\etc to contain the following:
127.0.0.1 myapp.com
I believe you could do just myapp(without the .com) as well, but that gets a bit trickier because how that is resolved depends on your node type. (hybrid, etc) To be safe, add
127.0.0.1 myapp
to BOTH the hosts and LMHosts files in the same directory. By default the lmhosts is non-existent and there is a lmhosts.sam there. You'll have to rename that to just lmhosts or create a new one.
Then create the binding as per usual in IIS7/7.5 (I assume it's 7... Site->Actions->Bindings->Add or Edit->Populate hostname accordingly).. IIS6 will work too but it's alot harder to get https working should you need it.