Skip to content

Commit 22855be

Browse files
committed
mod_alias is a built-in module, so let's just make it initialized by default
1 parent 07a0ff3 commit 22855be

File tree

7 files changed

+12
-43
lines changed

7 files changed

+12
-43
lines changed

CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,13 @@ set(PKG_CONFIG_ARGN --libs-only-l)
123123
add_subdirectory(lighttpd1.4)
124124

125125
set(PLUGIN_STATIC
126+
PLUGIN_INIT(mod_alias)\n
126127
PLUGIN_INIT(mod_dirlisting)\n
127128
PLUGIN_INIT(mod_h2)\n
128129
PLUGIN_INIT(mod_indexfile)\n
129130
PLUGIN_INIT(mod_staticfile)\n
130131
)
131132

132-
if(WITH_MOD_ALIAS)
133-
set(PLUGIN_STATIC "${PLUGIN_STATIC}PLUGIN_INIT(mod_alias)\n")
134-
endif()
135-
136133
if(WITH_MOD_WEBDAV)
137134
set(PLUGIN_STATIC "${PLUGIN_STATIC}PLUGIN_INIT(mod_webdav)\n")
138135
endif()

README.md

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -345,36 +345,16 @@ outside platform-specific sub-folders.
345345
### Enabling Alias Module
346346
[Enabling Alias module]: #enabling-alias-module
347347
348-
[Lighttpd]'s optional module [mod_alias] is used to specify a special document
349-
root for a given url-subset. To enable it:
348+
[Lighttpd] module [mod_alias] is used to specify a special document
349+
root for a given url-subset. To enable it just use `extraConfig` option of
350+
[Server] [constructor()] to load and configure it, for example:
350351
351-
1. **Android**: Edit `android/gradle.properties` file of your app, adding
352-
this flag:
353-
```gradle
354-
ReactNativeStaticServer_alias = true
355-
```
356-
357-
**iOS**: Use environment variable `RN_STATIC_SERVER_ALIAS=1` when
358-
installing or updating the pods (_i.e._ when doing `pod install` or
359-
`pod update`).
360-
361-
**macOS (Catalyst)**: The same as for iOS.
362-
363-
**Windows**: Does not require a special setup — the pre-compiled DLL
364-
for [mod_alias] is always packed with the library, and loaded if opted
365-
by [Server]'s [constructor()].
366-
367-
2. Use `extraConfig` option of [Server] [constructor()] to load and configure
368-
[mod_alias], for example:
369-
```ts
370-
extraConfig: `
371-
server.modules += ("mod_alias")
372-
alias.url = ("/sample/url" => "/special/root/path")
373-
`,
374-
```
375-
With this configuration incoming request `GET /sample/url/file` will be
376-
routed to the `/special/root/path/file`, rather than the `FILE_DIR/sample/url/file`,
377-
where `FILE_DIR` is the value you provided to the [Server]'s `fileDir` option.
352+
```ts
353+
extraConfig: `
354+
server.modules += ("mod_alias")
355+
alias.url = ("/sample/url" => "/special/root/path")
356+
`,
357+
```
378358
379359
### Enabling WebDAV Module
380360
[Enabling WebDAV module]: #enabling-webdav-module

android/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ android {
4343
// TODO: I guess, there should be a more elegant way to append
4444
// arguments here based on flags set in project Gradle properties,
4545
// but for now this will do.
46-
(project.properties["ReactNativeStaticServer_alias"] ? "-DWITH_MOD_ALIAS=ON" : "-DWITH_MOD_ALIAS=OFF"),
4746
(project.properties["ReactNativeStaticServer_webdav"] ? "-DWITH_MOD_WEBDAV=ON" : "-DWITH_MOD_WEBDAV=OFF")
4847
targets "lighttpd"
4948
}

dr-pogodin-react-native-static-server.podspec

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ $outputFiles = [
3232
'${BUILT_PRODUCTS_DIR}/libpcre2-8.a'
3333
]
3434

35-
if ENV['RN_STATIC_SERVER_ALIAS'] == '1' then
36-
$extraCMakeArgs += " -DWITH_MOD_ALIAS=ON"
37-
$libToolFlags += " -lmod_alias"
38-
$outputFiles.append('${BUILD_PRODUCTS_DIR}/libmod_alias.a')
39-
end
40-
4135
if ENV['RN_STATIC_SERVER_WEBDAV'] == '1' then
4236
$extraCMakeArgs += " -DWITH_MOD_WEBDAV=ON"
4337
$libToolFlags += " -lmod_webdav"

example/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ to prepare and run the example:
2929
- `npm run android`
3030
- On **iOS**:
3131
- ```sh
32-
cd ios && RCT_NEW_ARCH_ENABLED=1 RN_STATIC_SERVER_ALIAS=1 pod install
32+
cd ios && RCT_NEW_ARCH_ENABLED=1 pod install
3333
```
3434
Here `RCT_NEW_ARCH_ENABLED=1` is optional, omit it to build for the old RN
3535
architecture.

example/android/gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,4 @@ newArchEnabled=true
4343
# If set to false, you will be using JSC instead.
4444
hermesEnabled=true
4545

46-
ReactNativeStaticServer_alias = true
4746
ReactNativeStaticServer_webdav = true

example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ SPEC CHECKSUMS:
12901290
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
12911291
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
12921292
dr-pogodin-react-native-fs: 3ccf8b867c5feeae20dd41e05d7fde2c07f2119f
1293-
dr-pogodin-react-native-static-server: 55cbfca2b833f06ef1189f2256d3a5f1ceec5de3
1293+
dr-pogodin-react-native-static-server: 68f837a0534dbe71869852c8296398bbf9d9ebbc
12941294
FBLazyVector: 71803c074f6325f10b5ec891c443b6bbabef0ca7
12951295
Flipper: 6edb735e6c3e332975d1b17956bcc584eccf5818
12961296
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c

0 commit comments

Comments
 (0)