Hiding Port number in Shiny Apps using Shiny Server - shiny

I have deployed an app using Shiny Server on AWS instance. When I run Shiny app, it launched itself at URL XXX.XXX.XXX.XXX/8787/p/1234. I need to share this URL with my colleagues, but I want to hide IP+port number where shiny server is running i.e. I want to hide XXX.XXX.XXX.XXX/8787, or at least one of IP/ Port should not be visible to them. Is there any way out of hiding this?
I want my colleagues to see something like XXX.XXX.XXX.XXX/shiny/p/1234 (port number hided) or shiny/p/1234 (IP+port hided). Any help would be highly appreciated.

you probably already find your answer.
But a way of doing what you want is to use
<VirtualHost *:80>
...
ProxyPreserveHost On
ProxyPass /shiny http://0.0.0.0:3838/shiny
ProxyPassReverse /shiny http://0.0.0.0:3838/shiny
ServerName localhost
</VirtualHost>
In your httpd.conf 'your server config file this exemple is for apache'
Then you Can Access to your app in
http://ip_address/shiny/your_app_name

Related

Using Mod Rewrite with DJango redirecting to Port Number

I have Mod rewrite set to pick up people who come to the root of my domain and redirect them to the proper language folder in my Django
Im running a new Django with mod_wsgi under apache. I have an apache instance with a virtual server set to port 8005 and my load balancer pointed to that server and port.
I have only one rule in Mod Rewrite to redirect to US folder
RewriteRule ^(|/|/index.html)$ /us/ [QSA,NE,R=302,L]
When I try to go to my www.site.com I see in my trace logs its trying to redirect to www.site.com:8005/us/ instead it should go to www.site.com/us/
If I go to www.site.com/us/ works fine
In the apache configs i needed add servername hostname I had a different hostname that was preventing it from redirecting properly. I haven esperienced this problem on my non Django sites

Open cart 2.0, in WAMP the basic ui is not visibile to the other pc

Hi i just installed openCart in my localhost, and in my computer everythings fine,
and after Putting online my WAMPserver
i am able to see my page using other computer by ip address
but the design or the basic theme,css of my open cart is not loading...
any idea?
thanks.
Go to your config.php files (both in the root and in /admin) and change all the URLs from (probably) http://localhost/ to the IP e.g. http://192.168.1.123/
Note: you will need to use the IP when browsing from BOTH PCs in future.
That's probably the simplest solution. Depending on your WAMP setup, you can also set up an alias in the vhost e.g. "myopencart" and then add an entry in your hosts file on each PC to map this domain to the correct IP.
In the vhost:
ServerAlias myopencart
Hosts file on the hosting PC:
127.0.0.1 myopencart
and on the other PC:
192.168.1.123 myopencart
Then you can hit myopencart in the browser instead, which is nicer than an IP. But meh, that's all it is... nicer.
If you need more help with that, just google "virtualhost wamp", there are a million guides out there.

Allow only users who have predetermined uname/passwd to reach a Django website

I have a Django applciation running on Apache with mod_wsgi, but I would like to create a development server on the same machine.
I can reach my website by http://IP_ADD and I would like to reach the development server from http://IP_ADD:8080 or another port.
But as you notice, I would like to prevent accessing to 8080 port from users who do not enter predetermined username/password.
How can I achive such protection? I may allow only certain IP address but it is not a solution.
Another question is also about the chosen port. I hace choice 8080 port but I will also setup issue tracking system, SVN etc. and I am not sure which ports should I open for them.
Thank you
For each of the sites you want to host, you could create a separate Apache site with a VirtualHost file along the following lines:
<VirtualHost *:8080>
ServerName www.example.com:8080 // Your name (if available)
ServerAlias 12.23.34.45 // Your IP
DocumentRoot /var/www/mydjangoapp // Your folder
<Directory />
Order deny,allow
Deny from all
Allow from 127
AuthName "Restricted area"
AuthType Basic
AuthUserFile /etc/apache2/users_mydjangoapp // Allowed users file
require valid-user
</Directory>
The userfile itself can be generated using Apache's authentication system. For each site, you could add a seperate user file to contain the access for that part of your system. For IP based access, just add lines like Allow from 123.123.123.123 below the Allow from 127 line.
Finally, additional sites can be created by creating more of these Apache sites (see for example here for more details). Just adapt the port (8080 in my example) to the one you want to host the additional sites under.
you can add basic authentication
http://djangosnippets.org/snippets/1304/

Running the django admin over https using apache2

I have a django web application that's running on apache 2.2.14 and I want to run the admin application over https.
Having read considerable discussions on using a proxy, writing middleware, running alternative wsgi scripts, the chaps in #httpd came to my rescue. The solution is so simple, I was surprised I didn't find it online, so I'm curious to see if I've made some glaring assumptions or errors.
One complication was that I also wanted to run one of my django apps in the site over https, that is everything on /checkout.
Essentially, if a user requests a URI starting with /admin or /checkout on http, they are to be redirected to that URI but on https. Conversely, if a user requests a URI that does not start with /admin or /checkout on https, they are to be redirected to that URI but on http.
The key to solving this problem was to use Redirect and RedirectMatch directives in my VirtualHost configuration.
<VirtualHost *:80>
... host config stuff ...
Redirect /admin https://www.mywebsite.com/admin
Redirect /checkout https://www.mywebsite.com/checkout
</VirtualHost>
<VirtualHost *:443>
... ssl host config stuff ...
RedirectMatch ^(/(?!admin|checkout).*) http://www.mywebsite.com$1
</VirtualHost>
Another approach is to use #secure_required decorator. This will automatically rewrite the requested url and redirect to https://... version of the URL. Then you don't have to have Redirect in *:80 configuration. *:443 configuration may still be required for performance purpose if you want other traffic to go through normal http traffic.
I tried your solution, but ran into several problems. First, the formatting on the admin site disappeared, as if it could not find the admin static files. Second, if I tried to reach the non-admin site through https, the browser would not find it and redirect me to Yahoo search. Oddly, if I edited the yahoo search URL to eliminate all text except my correct URL (minus the http://), it would continue to search through yahoo for my site. However, typing the exact same URL afresh sent me to my site.
I solved all of these issues by simply removing the
RedirectMatch ^(/(?!admin|checkout).*) http://www.mywebsite.com$1
directive.
I should mention that I don't have a /checkout section on my site and am only trying to secure /admin. ... and yes, I did substitute my URL for "mywebsite.com"
What you described should work, but there may be a problem in the future if you need to make changes to which paths are/are not HTTPS. Because this method requires the ability to correctly modify the Apache config file it means you do not want novices in the loop. Screw up the config file and your site can go 500-error in the blink of an eye.
We chose to have a simple text file that had a list of the must-be-HTTPS paths. Anyone on the project can edit it and it is checked for correctness when it is loaded. We handle any needed redirects to/from HTTPS in middleware and it seems to work just fine. This method will also work if you are running anything other than Apache.

MediaWiki installed on virtual server accessed through Apache ProxyPass

Note: where you will see "xttp" actualy is "http" but stackoverflow rules do not allow me to use more than 1 hyperlink in one post because I do not have enough "credit" to do that :)
INTRODUCTION
Hi,
I have installed a MediaWiki 1.15.3 software on a private LAN on a Linux box (CentOS 5), with: Apache 2.2.3, PHP 5.1.6, MySQL 5.0.45. Let's name this Linux box "wiki box".
Public users can't access this wiki as it is hosted on a private LAN.
For external users (the Internet users) we have a Linux router (with Apache 2.0.52) where we host our website (ex: xttp://www.cubique.ro). Let's name this Linux box "router".
WHAT I WANT
What I want to do is:
to create a virtual domain (as xttp://wiki.cubique.ro) on the "router"
setup the virtual domain to forward all xttp requests to my private "wiki box" (ex: xttp://192.168.0.200/wiki_root/)
WHAT I'VE DONE ALREADY
On router's Apache (httpd.conf) I have created a VirtualHost as:
< VirtualHost 0.0.0.0:80 >
ServerName wiki.cubique.ro
DocumentRoot /someinternalpath/html
ScriptAlias /cgi-bin /someinternalpath/cgi-bin
...
Well, after I have navigate at wiki.cubique.ro I saw a blank web page, as /someinternalpath/html has an empty index.htm page.
No problem, I know that I have to "teach" the router to pass all the access of virtual domain (wiki.cubique.ro) to the wiki box, where the real pages are stored.
So I teach the Apache to ProxyPass the access of virtual domain root to the wiki box root like this:
...the following lines lies in the same virtual domain definition, see above
ProxyPass / xttp://192.168.0.200/wiki/
ProxyPassReverse / xttp://192.168.0.200/wiki/
< /VirtualHost >
WHAT IS THE ISSUE
If I access the wiki using the internal address (such as xttp://192.168.0.200/wiki/) it looks splendid (style sheets, everything).
When I access the wiki using the virtual domain name ( xttp://wiki.cubique.ro ) it shows the content but no style sheet. Worse than that, no internal wiki links are working at all.
Make a try: http://wiki.cubique.ro
FINALLY, THE QUESTION
Anyone has a clue how to deal with this?
Thanks.
You should check your path variables in LocalSettings.php, especailly $wgStylePath and $wgServer