1

I would like my web application to run only in one web browser.

E.g. my application URL is: http://localhost:8080/project

I want to restrict this URL in only one browser. If I choose Mozila Firefox for project, this URL can't run in another browswer like IE, chrome etc.

Is it possible to handle?

Drumnbass
  • 867
  • 1
  • 14
  • 35
Ye Win
  • 2,020
  • 14
  • 21

2 Answers2

3

Why would you want to do that? With Javascript you can detect different browsers and work in accordance....

https://stackoverflow.com/a/5918791/3617531

EDIT

Anyway, you can check the UserAgent in apache:

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} (OneMobileUserAgent|AnotherUserAgent|...)
RewriteRule (.*) userAgentA/$1

EDIT 2

Just found a good web with lots of info about the user agent and parsing it. Hope it may help you yo find your ideal solution: https://developer.jboss.org/thread/177392?_sscc=t

EDIT 3

As you commented: I´ll try to explain twe two first methods (javascript) and Apache.

Javascript has a system for querying HTTP HEADERS. One of them is the USER_AGENT the client send this header to indentify itselfs. This is obviously used to format webs according to the browser, or to show messages that tell the user to use another browser to see the page.

The user agent is easily detected in javasript with the navigator.userAgent variable you can check. Here you can read more about http://en.wikipedia.org/wiki/User_agent

Also, Apache can check the HTTP_USER_AGENT variable that will be checked in your .htaccess

The .htaccess is a file that will tell apache how to run in a particular directory. There, yoy must use the module "mod_rewrite" that lets you make apache act as a proxy, and then, for example, deny the conection depending on the userAgent detected:

RewriteEngine On

//allow access to useragentA
RewriteCond %{HTTP_USER_AGENT} UserAgentA
//This line will redirect the user to http://yourdomain.com/webappForuserAgentA
RewriteRule (.*) webappForuserAgentA/$1 [P,R,L]

//Deny (F) access to userAgentB (it will give the error to the client with the wrong browser
RewriteCond %{HTTP_USER_AGENT} UserAgentB
RewriteRule ^.* - [F,L]

There you have a guide for .htaccess mod_rewrite with apache.

http://www.javascriptkit.com/howto/htaccess13.shtml

Community
  • 1
  • 1
1

You can set the maximum connections count for your JBoss server. This is done by setting a value for the max-connections attribute for the JBoss Connector.

According to the documentation, the max-connections attribute:

Max of connections supported by the connector.

So, in order to set it, open the jbossweb.sar/server.xml file and set max-connections to1`

<Connector protocol="HTTP/1.1" port="8080" 
           address="${jboss.bind.address}" connectionTimeout="20000" 
           redirectPort="8443" max-connections="1" /> 

With this, JBoss won't allow a second connection to be established when the first one is still active.

Konstantin Yovkov
  • 62,134
  • 8
  • 100
  • 147
  • 2
    I think you misunderstood the question. I think OP wanted to limit the application to be used only by one _user agent_. – Magnilex May 14 '15 at 11:23