I want deploy my app with shiny using command shiny::runApp(). My question is if it's possible to do this use https instead of http (I can't install shiny server).
Now I run in this mode: shiny::runApp("app.R", port=3090, host="myipaddress"). I have a domain that point in the ip address and if I write in browser: http://mydomain:3090 works correctly.
My problem is that I can't find any mode to switch from http://mydomain:3090 to https://mydomain:3090.
Any help is appreciated
As suggest Sergio Romero I have used reverse proxy on apache on port 443 and handle ssl certificate.
I followed this guide to setting configuration of Virtual Host on Apache
<VirtualHost *:443>
ServerName mydomainname
<Proxy *>
Allow from mydomainname
</Proxy>
RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) ws://mydomainname:myport/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) http://mydomainname:myport/$1 [P,L]
ProxyPass / http://mydomainname:myport/
ProxyPassReverse / http://mydomainname:myport/
ProxyRequests Off
## SSL directives
SSLEngine on
SSLCertificateFile "path_to_cert.pem"
SSLCertificateKeyFile "path_to_privkey.pem"
SSLCertificateChainFile "path_to_fullchain.pem"
</VirtualHost>
Related
I have been looking around for an answer to my problem for a while and have read various other answers without coming across one that works for me.
The problem I am trying to solve involves redirecting access to a WordPress site installed on an Apache server. The WordPress site is one of many installed as part of a WordPress Network installation and the site is setup on the domain https://www.mysite1.co.uk.
It is also necessary to access the site using a number of server aliases, which are to be redirected to the root domain. I have created the additional domains as server aliases in the Apache configuration, and have set redirects to ensure that if one of the aliases is entered then it should be redirected to the root domain.
<VirtualHost *:80>
ServerName www.mysite1.co.uk
ServerAlias mysite1.co.uk www.mysite2.co.uk mysite2.co.uk
...
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)\.?$ [NC]
RewriteRule ^ https://www.mysite1.co.uk%{REQUEST_URI} [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerName www.mysite1.co.uk
ServerAlias mysite1.co.uk www.mysite2.co.uk mysite2.co.uk
...
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)\.?$ [NC]
RewriteRule ^ https://www.mysite1.co.uk%{REQUEST_URI} [R=301,L]
SSLEngine On
SSLCertificateFile "certs/mysite1.co.uk.crt"
SSLCertificateKeyFile "certs/mysite1.co.uk.key"
</VirtualHost>
This configuration works whenever the user enters one of the aliases using http, they are redirected to https://www.mysite1.co.uk/. However, if they enter the aliases using https, instead of being redirected to https://www.mysite1.co.uk/, they are not being redirected at all.
Have I missed something in the configuration, or do I need to separate the https configuration and add the aliases into their own virtual host to do the redirect.
The sites are hosted on CentOS 7.9.2009 and running Apache 2.4.6.
If I got it correctly, you're trying to redirect every known domain reaching your apache to just one domain and when the connection comes as HTTP you want to redirect it to HTTPS.
To keep the configuration simple, I would create 3 different virtual hosts:
The first one will listen on http and include every domain you want to redirect (including the main one becuase it's listening on http). This virtualhost will redirect everything to the main domain over https:
<VirtualHost *:80>
ServerName main.site.com
ServerAlias mysite.example.com
ServerAlias another.site.com
Redirect permanent / https://main.site.com/
</VirtualHost>
The second one will listen on https port and includes all the domains but the main one and redirect it to your primary domain (it's like the previous one except it doesn't include the main domain)
<VirtualHost *:443>
ServerName mysite.example.com
ServerAlias another.site.com
Redirect permanent / https://main.site.com/
...
SSLEngine On
...
</VirtualHost>
In the end, the main one will just listen on https and will include only the main domain:
<VirtualHost *:443>
ServerName main.site.com
...
SSLEngine On
...
</VirtualHost>
This way, the only virtualhost requiring configuretiona (document root, locations, etc.) is the last one.
I have deployed an application on WebSphere Application Server v9.0 and enabled SSL for this application (listening on port 443) by adding the below in httpd.conf file and it works just fine.
LoadModule ibm_ssl_module modules/mod_ibm_ssl.so
<IfModule mod_ibm_ssl.c>
Listen 0.0.0.0:443
<VirtualHost *:443>
Alias /jde "Z:\IBM\WebSphere\AppServer\profiles\AppSrv/installedApps/<cellName>/<appName>.ear\webclient.war"
SSLEnable
</VirtualHost>
<Directory "Z:\IBM\WebSphere\AppServer\profiles\AppSrv/installedApps/<cellName>/<appName>.ear\webclient.war\WEB_INF">
Require all denied
</Directory>
<Directory "Z:\IBM\WebSphere\AppServer\profiles\AppSrv/installedApps/<cellName>/<appName>.ear\webclient.war">
Require all granted
</Directory>
SSLDisable
KeyFile Z:\IBM\HTTPServer/<srvrname>.kdb
I can now successfully access the application using the URL https://srvrname/jde/E1Menu.maf
Is there a way the URL can be updated/redirected to https://srvrname/jde/E1Menu.maf when a user enters http://srvrname/jde/E1Menu.maf in the browser. Thanks !
Use the rewrite_module by adding the following to the httpd.conf:
LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine on
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
Full documentation can be found here: https://www.ibm.com/support/pages/node/72233
When I execute my Blazor app on localhost everything is fine. When I upload the compiled code to my final server, the app works but all CSS/JS are missing.
I use Centos 7 + Apache in reverse proxy mode.
My CNF:
<VirtualHost *:*>
RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
</VirtualHost>
<VirtualHost *:80>
# Your domain name
ServerName 192.168.5.69
ProxyPreserveHost On
# The IP and port of the JBoss Enterprise Application Platform
# These represent the default values, if your HTTPD is on the same host
# as your JBoss Enterprise Application Platform managed domain or server
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
# The location of the HTML files, and access control information
DocumentRoot /var/www/html
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule /(.*) ws://127.0.0.1:5000/$1 [P]
<Directory /var/www/html>
Options -Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
On Chrome console I see:
Siti:12 GET http://192.168.5.69/js/JavaScriptInterop.js net::ERR_ABORTED 404 (Not Found)
Siti:11 GET http://192.168.5.69/css/site.css net::ERR_ABORTED 404 (Not Found)
Siti:10 GET http://192.168.5.69/css/font-awesome/font-awesome.min.css net::ERR_ABORTED 404 (Not Found)```
Hello dear stackoverflow!
I'm having trouble setting up shiny server and apache2 routing.
Roughly following this guide https://support.rstudio.com/hc/en-us/articles/213733868-Running-Shiny-Server-with-a-Proxy (but with apache2)
I set up shiny to run on my 127.0.0.1:2224 port. Everything works just fine when I open a tunnel and port forward, I see my app on localhost.
I set up pwd and redirection in apache as:
<VirtualHost *:80>
ServerAdmin karin#localhost
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPass "/myapp" "http://localhost:2224"
ProxyPassReverse "/myapp" "http://localhost:2224"
<Location /myapp>
AuthType Basic
AuthName "Enter your login name and password"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Location>
And when I open public my.ip/myapp I am prompted to log in, and after doing so I am redirected to local port 2224, yay!
~ however, the app seems to be broken. I can't see any of the resources, images, css - just the plain interface as coded in the app ui.R
I see a plenty of 404 in logs, the shiny server is looking for all these resources on the web, with address my.ip/shared/whatever - but the resources are accessible only through localhost:2224/shared/whatever
...
any idea where I messed up the routing? What privileges are missing, or what to try to be able to access my app without setting up ssh tunnel and port forward?
Thanks a lot for any ideas!
Roughly following this guide https://support.rstudio.com/hc/en-us/articles/213733868-Running-Shiny-Server-with-a-Proxy (but with apache2)
I have had success in using apache2 as a reverse proxy for shiny server when following that guide in detail, in particular the last examples. In your case, you should replace
ProxyPass "/myapp" "http://localhost:2224"
ProxyPassReverse "/myapp" "http://localhost:2224"
with
RedirectMatch permanent ^/myapp$ /myapp/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /myapp/(.*) ws://localhost:2224/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /myapp/(.*) http://localhost:2224/$1 [P,L]
ProxyPass /myapp/ http://localhost:2224/
ProxyPassReverse /myapp/ http://localhost:2224/
Header edit Location ^/ /myapp/
ProxyRequests Off
I am trying to integrate wordpress into my site which is running on Nodejs server with Apache Httpd port forwarding enabled to forward all the request from 80 port to Nodejs port 9000. I have installed wordpress into Apache httpd /www/blog folder.
Now, i want to edit my httpd.conf so that all my requests coming from client should still be forwarded to nodejs server except my blog.example.com calls which should not be proxy forwarded and they should point to /www/blog folder. Is this possible ?
Here is the Virtualhost code from httpd.conf :-
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://localhost:9000/
ProxyPassReverse / http://localhost:9000/
ServerName example.com
</VirtualHost>
Any help would be appreciated.
This worked for me. Might be of some help for others.
<VirtualHost *:80>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^blog\.example\.com
RewriteRule ^(.*)$ http://www\.example\.com/blog/$1 [L]
ProxyPreserveHost On
ProxyPass /blog !
ProxyPass / http://localhost:9000/
ProxyPassReverse / http://localhost:9000/
ServerName example.com
</VirtualHost>