Identical files in group A server A show perfectly, but not group B in DreamHost server B

In two different servers, actually 3, I have copied the same identical files.

They are a total of over 180 files.

In Servers A and A1, everything shows perfectly.

I copied all 180 files to a Dreamhost server (B) and the files are 100% identical, however, as the each html is served from the DreamHOst server, errors in the looks of the page make it unusable.

The exact identical html pages when served from servers A and A1 (all of them Ubuntu, Linux) show perfectly well.

I have a zip file to unzip at the DreamHost server, but I can not find a way to open the zip file using webftp or sftp tools; I need to test with console command; however; I doubt that will solve the problem since I have compared all involved files and they all reporte identical content, byte by byte.

I would like to write down here the way to see the difference, but I do not know if working urls are permitted here.

Since the editor is showing hyperlink, I guess it is permitted:

Server A

Server B

Servers A and A1, at 12:53 on 2018-06-28 show the pages correctly.

Server B (hosted at DreamHost) does not show pages correctly.

(I had to take away server A1 because as a new USER I can only include 2 URLs in the post. Not much sense in this particular case, but that is how information systems “understand“ things).

The two sites look different because B is serving its CSS with the wrong MIME content-type (text/plain). Server A serves CSS with no content-type, which browser accept. For example, here’s a comparison of the headers using curl:

$ curl --head
... no content-type header...

$ curl --head
... Content-Type: text/plain ...

Normally, Apache will serve files with the extension .css with the content-type of text/css. However, because your CSS is severed from a file with no extension, Apache will serve it as text/plain by default.

Possibly, server A has a .htaccess that sets custom MIME content-types? Maybe that .htaccess file didn’t get transferred to B, or maybe the .htaccess file is positions above the directory you transferred?

In this case it is better to serve with no content-type? Site A is my AWS fully managed (by me) server. B is Dreamhost server only partially managed by me.

Site A does NOT have any .htaccess file; side B does not, either. Or does it? Let me see…

Site B is controlled by DreamHoster and as far as the structure available to me, there is no .htaccess to define.

In this case I should add in the directories not to send any content-type header, and then it will work (in all browser; site A does work in all browsers correctly whereas site B does not work correctly in any site).

In this case, I would rather Apache did not send any content-type header… How can I get this behavior with the dreamhoster site?

Thanks for your attention, habilis. Such a good idea to use markdown for this.

Site B is now OK in the first link. I need to fix the other links.

Three files needed to be called with their correct “.css” ending.

Working on the rest. It should be all right soon. However, it is still important to find out why Site A (what configuration does it have that is different from Site B) was showing the css as css… or why browsers were interpreting it correctly from the first moment on.

The reason you’re seeing differences is because of differences in the Apache version and configuration on AWS vs DreamHost. First, your AWS server is using Apache 2.4, while DreamHost uses Apache 2.2 (on Shared/Managed-VPS) – the two versions may have different defaults.

Secondly, the global configuration of Apache is likely different between a typical AWS server and a DreamHost server. DreamHost’s Apache configuration is setup for the needs of supporting a large user-base on shared/vps servers, so many default configurations (like default content-type) are probably setup to be as “user friendly” as possible.

Almost all of the default configurations can be overridden with .htaccess directives. For example, I believe you could use the DefaultType directive to reset the default text/plain to None.

Having said that, I think it would be best to always serve CSS with the appropriate MIME type (text/css). For files without extensions, you could use the ForceType or DefaultType directives to selectively apply MIME types.

1 Like

Having said that, I think it would be best to always serve CSS with the appropriate MIME type (text/css). For files without extensions, you could use the ForceType or DefaultType directives to selectively apply MIME types.

That is correct! I have fixed the files and now they should work under any Apache version.

Thanks a lot for your help!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.