Skip to content

Commit 036f545

Browse files
committed
Documentation update for nginx and IIS
1 parent bcb248e commit 036f545

File tree

3 files changed

+49
-7
lines changed

3 files changed

+49
-7
lines changed

docs-website/docs/getting-started.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,27 @@ export class AppComponent {
116116

117117
### Production Issues?
118118

119-
**PDF viewer stuck at loading screen in production (nginx)**
119+
**PDF viewer stuck at loading screen in production**
120120

121-
This is caused by incorrect MIME types for `.mjs` files. Add to your nginx configuration:
121+
This is caused by incorrect MIME types for `.mjs` and `.ftl` files.
122122

123+
**Nginx configuration:**
123124
```nginx
124125
types {
125126
application/javascript js mjs;
127+
text/plain ftl;
126128
}
127129
```
128130

129-
**Why**: PDF.js v5+ uses ES modules (`.mjs` files) that need proper MIME type configuration.
131+
**IIS configuration (web.config):**
132+
```xml
133+
<staticContent>
134+
<mimeMap fileExtension=".mjs" mimeType="application/javascript" />
135+
<mimeMap fileExtension=".ftl" mimeType="text/plain" />
136+
</staticContent>
137+
```
138+
139+
**Why**: PDF.js v5+ uses ES modules (`.mjs`) and localization files (`.ftl`) that need proper MIME type configuration.
130140

131141
## What's Next?
132142

docs-website/docs/installation.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,32 @@ your-app@1.0.0 /path/to/your-app
2828

2929
### Nginx Configuration
3030

31-
For production deployments using nginx, you may need to configure MIME types for PDF.js ES modules (`.mjs` files):
31+
For production deployments using nginx, configure MIME types for PDF.js ES modules:
3232

3333
```nginx
3434
# Add to your nginx.conf or site configuration
3535
types {
3636
application/javascript js mjs;
37+
text/plain ftl;
3738
}
3839
```
3940

40-
**Why this is needed**: PDF.js v5+ uses `.mjs` files (ES modules). Without proper MIME type configuration, nginx serves these files with incorrect content-type headers, causing the PDF viewer to crash during loading in production environments.
41+
### IIS Configuration (Windows Server)
42+
43+
For production deployments using IIS, add to your `web.config`:
44+
45+
```xml
46+
<configuration>
47+
<system.webServer>
48+
<staticContent>
49+
<mimeMap fileExtension=".mjs" mimeType="application/javascript" />
50+
<mimeMap fileExtension=".ftl" mimeType="text/plain" />
51+
</staticContent>
52+
</system.webServer>
53+
</configuration>
54+
```
55+
56+
**Why this is needed**: PDF.js v5+ uses `.mjs` files (ES modules) and `.ftl` files (localization). Without proper MIME type configuration, web servers serve these files with incorrect content-type headers, causing the PDF viewer to crash during loading in production environments.
4157

4258
**Symptoms**: Everything works locally but the viewer gets stuck at the loading screen in production.
4359

lib/README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,16 +219,32 @@ Add PDF.js assets to your `angular.json`:
219219

220220
#### Nginx Configuration
221221

222-
For production deployments using nginx, you may need to configure MIME types for PDF.js ES modules (`.mjs` files):
222+
For production deployments using nginx, configure MIME types for PDF.js ES modules:
223223

224224
```nginx
225225
# Add to your nginx.conf or site configuration
226226
types {
227227
application/javascript js mjs;
228+
text/plain ftl;
228229
}
229230
```
230231

231-
**Why this is needed**: PDF.js v5+ uses `.mjs` files (ES modules). Without proper MIME type configuration, nginx serves these files with incorrect content-type headers, causing the PDF viewer to crash during loading in production environments.
232+
#### IIS Configuration (Windows Server)
233+
234+
For production deployments using IIS, add to your `web.config`:
235+
236+
```xml
237+
<configuration>
238+
<system.webServer>
239+
<staticContent>
240+
<mimeMap fileExtension=".mjs" mimeType="application/javascript" />
241+
<mimeMap fileExtension=".ftl" mimeType="text/plain" />
242+
</staticContent>
243+
</system.webServer>
244+
</configuration>
245+
```
246+
247+
**Why this is needed**: PDF.js v5+ uses `.mjs` files (ES modules) and `.ftl` files (localization). Without proper MIME type configuration, web servers serve these files with incorrect content-type headers, causing the PDF viewer to crash during loading in production environments.
232248

233249
### Angular Version Support
234250

0 commit comments

Comments
 (0)