I created a small application with Angular and an API with Spring Boot, containing an embedded tomcat server.
I am trying to deploy them on a single raspberry pi, by configuring an ssl certificate with let's encrypt.
I installed apache 2, created a virtual host for the angular part, created and installed an ssl certificate with certbot. There everything is fine. The APi part is compiled in .jar, and I launch it when the pi starts from the command line. The onboard tomcat server listens on port 8080.
My enabled conf :
<IfModule mod_ssl.c>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName website.me
ServerAdmin mail@gmail.com
DocumentRoot /var/www/html/website
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
SSLCertificateFile /etc/letsencrypt/live/website.me/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/website.me/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
RewriteCond %{REQUEST_URI} ^/rest/.*$
RewriteRule ^/rest/(.*) http://website.me:8080/rest/$1 [L]
# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html
</VirtualHost>
</IfModule>
proxy.conf :
<IfModule mod_proxy.c>
LogLevel proxy:trace5
ProxyPreserveHost on
ProxyRequests Off
#RequestHeader set X-Forwarded-Proto https
#RequestHeader set X-Forwarded-Port 443
#RequestHeader set Access-Control-Allow-Origin "https://website.me"
ProxyPassMatch .+\.html$ !
ProxyPassMatch .+\.js$ !
ProxyPass ^/rest/(.*)$ http://127.0.0.1:8080/rest/$1
ProxyPassReverse ^/rest/(.*)$ http://127.0.0.1:8080/rest/$1
</IfModule>
Dimensioned configuration of apache2, I have a redirection of listening on port 80 to 443 and a redirection for everything that happens in / rest / * to port 8080. And there necessarily it does not work. Cross origin security error.
I tried to configure a proxy and make cross origin possible in apache2 without success ...
I don't know what to do... any idea ?