Nginx is Slower than Apache downloading main.bundle.js - apache

I have an Angular2 app that I've been developing for a bit now. Locally I run an Nginx server but the deployment server is using Apache. To unify things I worked to move the deployment server to Nginx but I am getting extremely slow results with Nginx.
Apache loads in ~5 seconds (1.1MB transferred)
Nginx loads in 16-20 seconds (5MB transferred)
These are both on the same server pointing to the exact same directory. The actual size of main.bundle.js is 4470365 main.bundle.js so it seems Nginx is loading the entire file.
How is Apache able to download only 737K?

You can check for the features enabled in both the files with nginx and apache by clicking on the exact file in Inspect element Network Tab. Then go to Headers and then Response Headers as illustrated in the attached image.
Check if the gzip compression is enabled in any one of the server. That is the only reason for lesser file size.

Related

How to apply changes to HTML pages on Apache web server

I am trying to update the website hosted on my Apache server (running on Fedora Server).
I tried doing both system restart httpd and system reload httpd, but when I open up a web browser and go to the site's IP address, the changes haven't applied. I viewed the source to confirm that the updated code wasn't there, and indeed the updated code was not there.
It seems like the .htaccess was working, it just hadn't "kicked in" yet I guess. I set the max-age to 10 and the updates applied.

Apache static data file caching

I have a VPS with Centos 7 and Apache 2.4. This server acts as a backend data source for a mobile app. Periodically new data files with unique file names are generated, after which they are never changed. I am looking for the best way to get Apache to cache these data files in memory without restarting the server each time a datafile is generated. Thank you in advance for your help.
In apache 2.4 you could use the mod_cache module. More infos about this on the official apache website:
https://httpd.apache.org/docs/2.4/caching.html
Not sure I understand the "without restarting the server each time a data file is generated" part!

Fileupload with CMIS + Apache fails due to "Proxy Error"

We developed a web application which uses opencmis and a windows client which uses dotcmis. The web application runs behind an apache httpd.
We are facing the following problem:
Small files can be uploaded by the client without problems (< 1,5 gigabytes).
However, if we try to upload larger files, we get a "Proxy Error". The stacktrace does not give any more information.
We also tried to upload via cmis workbench with the same result...
Are there any configuration parameters for apache we maybe overlooked? Or do you think the problem should be searched elsewhere?
EDIT: I should mention, that the file is uploaded completely nevertheless. And also: We tried disable apache, connect via http instead of https and upload a file and it works perfectly.
EDIT2: We found a solution, although it does not seem to be a very good one... We set the following configuration entries in httpd.conf:
Timeout=500 and ProxyTimeout=500. Default value is 60 for these entries.
This solved the problem. However, it would be nice to know, why this problem occures in the first place.
Greets

HAProxy + mod_pagespeed

I have currently 3 web server configuration with HAProxy dividing the traffic to one of each web server. Each server is running apache2 with mod_pagespeed. The HAProxy takes care of the SSL termination as the web servers are in local network.
HAProxy sets the X-Forwareded-Proto header to each request and I have enabled "ModPagespeedRespectXForwardedProto on" in each pagespeed configuration.
Apache services are running in custom port 8012 and now I am getting an error to javascript console from pagespeed when going to the site:
Mixed Content: The page at 'https://www.example.com/' was loaded over HTTPS, but requested an insecure script 'http://www.example.com:8012/_,Mjo.NZsywmsdso.js.pagespeed.jm.OLNkjPSHpv.js'. This request has been blocked; the content must be served over HTTPS.
Any idea what could still be wrong? Here is the pagespeed HTTPS configuration:
ModPagespeedFetchFromModSpdy on
ModPagespeedFetchHttps enable
ModPagespeedSslCertDirectory /etc/ssl/certs
ModPagespeedSslCertFile /etc/ssl/certs/cert.pem
ModPagespeedMapOriginDomain "http://www.example.com" "https://www.example.com"
ModPagespeedRespectXForwardedProto on
Any help is appreciated!
This question is old, but I am going to answer how I fix it on my own setup.
The issue comes if you are using pagespeed on each server vs somehow running it on haproxy itself for caching. Since pagespeed saves a copy of any modified file with a modification on filename, then it also changes the source of the HTML to match that new filename it stored, which should work fine. But the issue is that is pagespeed on web server 1 is modifying the HTML to match background compressing of the files(images, js, css, etc) then when it gets to the users computer and their browser requests such files it wont find it if you are round-robin it between servers because that file will be only on web server 1 and not on the others, the way around it is to use a shared folder for the pagespeed so when one compresses a file into that folder, the other web servers will see it through their pagespeed.

JSP file is served as plain/text, when TOMCAT is behind an APACHE server

I'm running in a strange problem. I have a project based on MAVEN. When I run the project directly from my computer for testing it, using mvn tomcat7:run, my website display is correct. When I upload it to my distant Tomcat server, that is accessed through the JK Apache Tomcat connector, the JSP page is served as a text file. In response headers, I can see Content-Type:text/plainwhich is almost strange, and I'm suspecting the Apache server is adding it because of some erroneous configuration.
Any idea where to look, to fix this problem ?