Skip to content

Commit

Permalink
Specific build for IIS and Apache
Browse files Browse the repository at this point in the history
  • Loading branch information
emmguyot committed Jul 25, 2024
1 parent 3f83cca commit 7e0a197
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
9 changes: 7 additions & 2 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Planka client

IIS install
The build package for IIS requires URL rewrite module [https://www.iis.net/downloads/microsoft/url-rewrite]
## IIS install
The build package for IIS requires URL rewrite module https://www.iis.net/downloads/microsoft/url-rewrite
The web.config file is provided as is and should be enough. You might have to modify it to suit your needs.

## Apache install
The build package for Apache requires mod_rewrite module https://httpd.apache.org/docs/2.4/fr/mod/mod_rewrite.html
The .htaccess file is provided as is and should be enough. You might have to modify it to suit your needs.
10 changes: 9 additions & 1 deletion client/config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ const replaceBaseUrl = (compiler) => {
replaceInFile(info.targetPath, `"${BASE_URL_PLACEHOLDER}"`, '`${window.BASE_URL}/`');
} else if (/index\.html$/.exec(info.targetPath)) {
// For the main html file, we set a placeholder for sails to inject the correct value as runtime
replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, process.env.PUBLIC_URL);
if (process.argv.indexOf('--IIS') >= 0 || process.argv.indexOf('--APACHE') >= 0) {
if (process.env.PUBLIC_URL === undefined) {
// eslint-disable-next-line no-console
throw new Error('You have to define PUBLIC_URL in .env!');
}
replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, process.env.PUBLIC_URL);
} else {
replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, '<%= BASE_URL %>');
}
}
}
});
Expand Down
2 changes: 2 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"private": true,
"scripts": {
"build": "react-app-rewired build",
"build:iis": "react-app-rewired build --IIS",
"build:apache": "react-app-rewired build --APACHE",
"eject": "react-scripts eject",
"lint": "eslint --ext js,jsx src config-overrides.js",
"start": "react-app-rewired start",
Expand Down
7 changes: 7 additions & 0 deletions client/public/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Options -MultiViews

<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.html [QSA,L]
</IfModule>

0 comments on commit 7e0a197

Please sign in to comment.