[Everything HTTP Server] content-type in response

Discussion related to "Everything" 1.5.
Post Reply
brandySnake
Posts: 37
Joined: Fri Sep 24, 2021 3:00 pm

[Everything HTTP Server] content-type in response

Post by brandySnake »

Is there a way to arbitrarily change the content-type of the response for GET requests with a specific file extension using the Everything HTTP Server plugin? (For example, defining
.js
as
application/javascript
in
Plugins-1.5a.ini
.)

The following code for registering a serviceWorker is causing an security error "unsupported MIME type".
I'm posting this to ask for advice on how to resolve this error.
*I've changed the
default_page
in
Plugins-1.5a.ini
and am using a custom html/js.

Service Worker registration code:

Code: Select all

navigator.serviceWorker.register("./Everything_sw.js");
Error:
Uncaught (in promise) SecurityError: Failed to register a ServiceWorker for scope (<<server_origin>>) with script (<<server_origin/script_path>>): The script has an unsupported MIME type ('application/octet-stream').
Environment:
- Everything: 1.5.0.1408a (x64)
- Everyting HTTP Server: 1.0.3.4 (x64)

Thank you in advance.
void
Developer
Posts: 19870
Joined: Fri Oct 16, 2009 11:31 pm

Re: [Everything HTTP Server] content-type in response

Post by void »

Everything pulls the content type from the registry.
If the content type is not defined, Everything falls back to application/octet-stream.

To change .js to application/javascript:
  • On the Server, from the Start menu, search for:
    regedit
  • Right click Registry Editor and click Run as administrator.
  • In the Registry Editor, navigate to:
    HKEY_CLASSES_ROOT\.js

    (If this key doesn't exist, please create it)
  • Create a new String Value
  • Set the value name to:
    Content Type
  • Set the value data to:
    application/javascript
brandySnake
Posts: 37
Joined: Fri Sep 24, 2021 3:00 pm

Re: [Everything HTTP Server] content-type in response

Post by brandySnake »

Thank you for your quick reply.

Based on your answer, I added the
Content Type
to the server machine side registry. As a result, it was reflected in the actual response headers.
Problem solved! Thank you!

I have an additional question regarding the HTTP Server.
For Service Worker/Web Worker requests, the csp-report "violated-directive: "worker-src", original-policy: "worker-src 'none'; report-uri about:blank"" is occurring.
(Note: This is not an error, only the sending of a report. Also, since there is no destination, it is not actually sent anywhere, and the console only shows a report sending error)

I have set
Content-Security-Policy
to
worker-src 'self'
in the
Plugins-1.5a
.ini of the
header
, and this is reflected in the actual response.
However, for some reason, the aforementioned csp-report is still occurring.
Do you have any advice on the cause and possible solutions?

■ Actual response Content-Security-Policy (includes worker-src 'self'):
default-src 'none'; child-src 'none'; frame-ancestors 'self'; script-src 'self'; style-src 'self'; worker-src 'self'; img-src 'self'; frame-src 'self'; connect-src 'self'; manifest-src 'self';
Post Reply