[GH-ISSUE #2434] Web resources transferred with the wrong MIME type #1706

Open
opened 2026-02-26 07:32:08 +03:00 by kerem · 9 comments
Owner

Originally created by @albio46 on GitHub (Nov 27, 2022).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2434

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes
  • Are you sure you're not using someone else's docker image?
  • Have you searched for similar issues (both open and closed)?
    • Yes, found this similar one: #284

Describe the bug
When accessing a proxied server, the browser blocks some resources because of a wrong MIME type

Nginx Proxy Manager Version
v2.9.19

To Reproduce
Steps to reproduce the behavior:
Perhaps it's an issue with custom locations:

  1. Access server like hostip/service
  2. inspect
  3. open console
    There may be errors loading some resources

Expected behavior

Screenshots
Console error

nextcloud, like this because it doesn't load css
homeassistant, stuck here because it doesn't load js

setup screenshots:
NPM, proxy host
and custom locations

Operating System
Raspberry pi (192.168.1.5) with raspberry OS and all the services are on docker, on the same bridge network: NPM (172.19.0.4), portainer (172.19.0.3), nextcloud (172.19.0.5) and homeassistant (172.19.0.2) of which NPM and portainer properly load, while nextcloud and homeassistant fail to load some resources

Additional context
Have tried with firefox and chrome. Accessing directly works fine.
NPM logs are clear, there is the browser request and the file is sent

Logs for a connection to NPM and then portainer
proxy-host-6_access.log
proxy-host-6_error.log

Logs for connections to nextcloud and then homeassistant
proxy-host-6_access.log
proxy-host-6_error.log

Originally created by @albio46 on GitHub (Nov 27, 2022). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2434 **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? - Yes - Are you sure you're not using someone else's docker image? - Yes, this is the [docker compose](https://github.com/NginxProxyManager/nginx-proxy-manager/files/10098218/docker-compose.txt) - Have you searched for similar issues (both open and closed)? - Yes, found this similar one: #284 **Describe the bug** When accessing a proxied server, the browser blocks some resources because of a wrong MIME type **Nginx Proxy Manager Version** v2.9.19 **To Reproduce** Steps to reproduce the behavior: Perhaps it's an issue with custom locations: 1. Access server like hostip/service 2. inspect 3. open console There may be errors loading some resources **Expected behavior** **Screenshots** [Console error](https://user-images.githubusercontent.com/18217650/204132956-2b350605-238b-4afc-a49e-0b5446166698.png) [nextcloud](https://user-images.githubusercontent.com/18217650/204132568-4371b58e-06a9-4ca1-9117-395365c4a262.png), like this because it doesn't load css [homeassistant](https://user-images.githubusercontent.com/18217650/204132605-53c7a031-ba36-4b95-9a04-b7e91abc11e4.png), stuck here because it doesn't load js setup screenshots: [NPM](https://user-images.githubusercontent.com/18217650/204132625-ab975d6b-b4cd-41df-8171-a4c7237c36a3.png), [proxy host](https://user-images.githubusercontent.com/18217650/204133880-7e463861-6550-47b7-a745-99964b777602.png) and [custom locations](https://user-images.githubusercontent.com/18217650/204132666-1fba51ba-6f62-41b6-8119-2bb8f9fb225c.png) **Operating System** Raspberry pi (192.168.1.5) with raspberry OS and all the services are on docker, on the same bridge network: NPM (172.19.0.4), portainer (172.19.0.3), nextcloud (172.19.0.5) and homeassistant (172.19.0.2) of which NPM and portainer properly load, while nextcloud and homeassistant fail to load some resources **Additional context** Have tried with firefox and chrome. Accessing directly works fine. NPM logs are clear, there is the browser request and the file is sent Logs for a connection to NPM and then portainer [proxy-host-6_access.log](https://github.com/NginxProxyManager/nginx-proxy-manager/files/10098199/proxy-host-6_access.log) [proxy-host-6_error.log](https://github.com/NginxProxyManager/nginx-proxy-manager/files/10098200/proxy-host-6_error.log) Logs for connections to nextcloud and then homeassistant [proxy-host-6_access.log](https://github.com/NginxProxyManager/nginx-proxy-manager/files/10098203/proxy-host-6_access.log) [proxy-host-6_error.log](https://github.com/NginxProxyManager/nginx-proxy-manager/files/10098204/proxy-host-6_error.log)
Author
Owner

@oywino commented on GitHub (Nov 28, 2022):

Using a LAN IP-Address as your domain name, is not correct. It cannot be resolved by DNS. And what is 172.19.0.4 ? You WAN-IP? Also, why did you add a slash ( / ) following the IP-Address in the Custom locations? I believe that's clearly also wrong.

<!-- gh-comment-id:1329681635 --> @oywino commented on GitHub (Nov 28, 2022): Using a LAN IP-Address as your domain name, is not correct. It cannot be resolved by DNS. And what is 172.19.0.4 ? You WAN-IP? Also, why did you add a slash ( / ) following the IP-Address in the Custom locations? I believe that's clearly also wrong.
Author
Owner

@albio46 commented on GitHub (Nov 28, 2022):

Using a LAN IP-Address as your domain name, is not correct. It cannot be resolved by DNS.

Of course not, I've excluded variables. By referring directly to the host in my Lan I'm sure it's not a DNS issue

And what is 172.19.0.4 ? You WAN-IP?

You're right I have not explained this properly. These are IPs of the docker containers in the bridge network.
Actually now that I think about it, both NPM and portainer (which properly work) have exposed ports, while the other two don't

Also, why did you add a slash ( / ) following the IP-Address in the Custom locations? I believe that's clearly also wrong.

I did that because when I connected with /nc, the stuff the service needed to address its pages was just appended so NPM didn't recognise the location anymore.
Something like /nc -> /ncindex.html
Also it works because communication exists, but something goes wrong in resource transfer

<!-- gh-comment-id:1329716926 --> @albio46 commented on GitHub (Nov 28, 2022): > Using a LAN IP-Address as your domain name, is not correct. It cannot be resolved by DNS. Of course not, I've excluded variables. By referring directly to the host in my Lan I'm sure it's not a DNS issue > And what is 172.19.0.4 ? You WAN-IP? You're right I have not explained this properly. These are IPs of the docker containers in the bridge network. Actually now that I think about it, both NPM and portainer (which properly work) have exposed ports, while the other two don't > Also, why did you add a slash ( / ) following the IP-Address in the Custom locations? I believe that's clearly also wrong. I did that because when I connected with `/nc`, the stuff the service needed to address its pages was just appended so NPM didn't recognise the location anymore. Something like `/nc` -> `/ncindex.html` Also it works because communication exists, but something goes wrong in resource transfer
Author
Owner

@albio46 commented on GitHub (Nov 28, 2022):

Actually now that I think about it, both NPM and portainer (which properly work) have exposed ports, while the other two don't

Tried exposing ports but nothing changed.

I've dwelved a little bit deeper in nginx configuration code and i've noticed that adding add_header Content-Security-Policy upgrade-insecure-requests; to the location configuration turns the error into this: Uncaught (in promise) TypeError: Failed to fetch dynamically imported module:

Not sure this is relevant or expected, don't know what i'm doing

<!-- gh-comment-id:1329795219 --> @albio46 commented on GitHub (Nov 28, 2022): > Actually now that I think about it, both NPM and portainer (which properly work) have exposed ports, while the other two don't Tried exposing ports but nothing changed. I've dwelved a little bit deeper in nginx configuration code and i've noticed that adding `add_header Content-Security-Policy upgrade-insecure-requests;` to the location configuration turns the error into [this](https://user-images.githubusercontent.com/18217650/204386132-5d9c926b-8f47-4537-99dc-7ea4b330f0eb.png): `Uncaught (in promise) TypeError: Failed to fetch dynamically imported module:` Not sure this is relevant or expected, don't know what i'm doing
Author
Owner

@github-actions[bot] commented on GitHub (Feb 3, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:1925011027 --> @github-actions[bot] commented on GitHub (Feb 3, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@jeremysherriff commented on GitHub (Nov 8, 2024):

This issue has suddenly started to affect me, although I am not sure of what the trigger was. Maybe a Chrome update, but my research indicates that strict MIME type checking has been in place for a long time.

All .css and .js files are transferring as text/html, but when I access the same (internal) sites without going through NPM then the content type is set correctly. My reasearch indicates that this can happen if the include mime.types directive is missing or the mime.types file is corrupt or missing entries. I am unsure how to check the full nginx config when using NPM.

Edit: I have found the mime.types file, confirmed the content and that it is being included in the nginx configuration correctly (nginx -T from inside the docker container),

@jc21
The issue ONLY occurs with subfolder/"location" blocks, if I create a new proxy host with the same configuration in the root server block then all content is given the correct content-type. Does that provide any context to help resolve these two open issues?

<!-- gh-comment-id:2465860275 --> @jeremysherriff commented on GitHub (Nov 8, 2024): This issue has suddenly started to affect me, although I am not sure of what the trigger was. Maybe a Chrome update, but my research indicates that strict MIME type checking has been in place for a long time. All .css and .js files are transferring as text/html, but when I access the same (internal) sites without going through NPM then the content type is set correctly. My reasearch indicates that this can happen if the `include mime.types` directive is missing or the mime.types file is corrupt or missing entries. I am unsure how to check the full nginx config when using NPM. Edit: I have found the mime.types file, confirmed the content and that it is being included in the nginx configuration correctly (`nginx -T` from inside the docker container), @jc21 The issue ONLY occurs with subfolder/"location" blocks, if I create a new proxy host with the same configuration in the root server block then all content is given the correct content-type. Does that provide any context to help resolve these two open issues?
Author
Owner

@github-actions[bot] commented on GitHub (Jun 14, 2025):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2972128609 --> @github-actions[bot] commented on GitHub (Jun 14, 2025): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@nkay08 commented on GitHub (Jul 27, 2025):

I have got the same issue.
I use NPM as reverse proxy to a dockerized webserver (nginx again). If I access my site without NPM, everything is correct. But if I access it through NPM, then my static files are transferred with the wrong content type.

<!-- gh-comment-id:3124663423 --> @nkay08 commented on GitHub (Jul 27, 2025): I have got the same issue. I use NPM as reverse proxy to a dockerized webserver (nginx again). If I access my site without NPM, everything is correct. But if I access it through NPM, then my static files are transferred with the wrong content type.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 19, 2026):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:3924311254 --> @github-actions[bot] commented on GitHub (Feb 19, 2026): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@jeremysherriff commented on GitHub (Feb 19, 2026):

This issue is the reason I moved away from NPM. The fact that it remains open after so long simply underscores that it was the right move.

<!-- gh-comment-id:3924317351 --> @jeremysherriff commented on GitHub (Feb 19, 2026): This issue is the reason I moved away from NPM. The fact that it remains open after so long simply underscores that it was the right move.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#1706
No description provided.