Author |
|
lpark
Joined: 06 Nov 2020 Posts: 9 Location: Germany
|
Posted: Tue 17 Nov '20 16:32 Post subject: Apache frontend can't request to express backend |
|
|
I'm hosting my vueJS frontend on an apache server. Without running the apache just by calling "npm run serve" and visiting my page over http (https is enabled on express backend), I can successfully request to the backend.
When starting apache and visiting the page over https (self-signed SSL certificate), I can't send requests.
Firefox error:
And chrome:
My ssl-conf is:
Code: | <VirtualHost _default_:443>
#ServerName pvapp.test-campus.de
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
DocumentRoot /var/www/client/pvapp-client/dist
#<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
#</FilesMatch>
#<Directory /usr/lib/cgi-bin>
# SSLOptions +StdEnvVars
#</Directory>
#BrowserMatch "MSIE [2-6]" \
# nokeepalive ssl-unclean-shutdown \
# downgrade-1.0 force-response-1.0
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost> |
The vhost-conf:
Code: | <VirtualHost *:80>
ServerAdmin webmaster@test.de
DocumentRoot /var/www/client/pvapp-client/dist
Redirect permanent / https://inf-education-47.umwelt-campus.de
<Directory /var/www/client/pvapp-client/dist>
AllowOverride None
Order allow,deny
Allow from All
#Require all denied
#Options -Indexes
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
</IfModule>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/test.com-error.log
CustomLog ${APACHE_LOG_DIR}/test.com-access.log combined
SecRuleEngine On
</VirtualHost> |
Appreciate all help/hints! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 18 Nov '20 14:42 Post subject: |
|
|
Why Redirect permanent and not a reverse proxy? |
|
Back to top |
|
lpark
Joined: 06 Nov 2020 Posts: 9 Location: Germany
|
Posted: Wed 18 Nov '20 16:36 Post subject: |
|
|
Would I need a reverse proxy to be able to communicate from the frontend (apache) with the backend (node)?
Cause that's the current problem.. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 19 Nov '20 12:49 Post subject: |
|
|
Yepp the Cross-source (cross-origin) would solve with a reverse proxy.
Something like
Code: |
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
# [...]
# vhost config
ProxyPass /user/ http://localhost:60702/user/
ProxyPassReverse /user/ http://localhost:60702/user/
|
Then you could be able to call from the frontend on the same server without a different domain name and without an extra port. |
|
Back to top |
|
lpark
Joined: 06 Nov 2020 Posts: 9 Location: Germany
|
Posted: Fri 20 Nov '20 11:45 Post subject: |
|
|
All right. Thank you! =) |
|
Back to top |
|