logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in  RSS Apache Lounge  


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.



Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache frontend can't request to express backend
Author
lpark



Joined: 06 Nov 2020
Posts: 9
Location: Germany

PostPosted: Tue 17 Nov '20 16:32    Post subject: Apache frontend can't request to express backend Reply with quote

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:

Quote:
Cross-source (cross-origin) request blocked: The same source rule prohibits reading the external resource on
https://143.93.46.35:60702/user/login. (Reason: CORS request failed).

And chrome:

Quote:
xhr.js:160 POST https://143.93.46.35:60702/user/login net::ERR_SSL_PROTOCOL_ERROR


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! Smile
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6859
Location: Germany, Next to Hamburg

PostPosted: Wed 18 Nov '20 14:42    Post subject: Reply with quote

Why Redirect permanent and not a reverse proxy?
Back to top
lpark



Joined: 06 Nov 2020
Posts: 9
Location: Germany

PostPosted: Wed 18 Nov '20 16:36    Post subject: Reply with quote

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: 6859
Location: Germany, Next to Hamburg

PostPosted: Thu 19 Nov '20 12:49    Post subject: Reply with quote

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

PostPosted: Fri 20 Nov '20 11:45    Post subject: Reply with quote

All right. Thank you! =)
Back to top


Reply to topic   Topic: Apache frontend can't request to express backend View previous topic :: View next topic
Post new topic   Forum Index -> Apache