feat(ui): Move PROXY setting to UI (#782)

Users who have set PROXY=yes in their Docker containers will need to configure this setting in the UI and restart the container.
This commit is contained in:
TheCatLady
2021-01-29 20:46:51 -05:00
committed by GitHub
parent 67f8aef00d
commit f1dd5e7e12
7 changed files with 41 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
# Fail2ban Filter # Fail2ban Filter
{% hint style="warning" %} {% hint style="warning" %}
If you are running Overseerr behind a reverse proxy, make sure that the `PROXY` environment variable is set to `yes`. If you are running Overseerr behind a reverse proxy, make sure that the **Enable Proxy Support** setting is **enabled**.
{% endhint %} {% endhint %}
To use Fail2ban with Overseerr, create a new file named `overseerr.local` in your Fail2ban `filter.d` directory with the following filter definition: To use Fail2ban with Overseerr, create a new file named `overseerr.local` in your Fail2ban `filter.d` directory with the following filter definition:

View File

@@ -17,7 +17,6 @@ After running Overseerr for the first time, configure it by visiting the web UI
docker run -d \ docker run -d \
-e LOG_LEVEL=info \ -e LOG_LEVEL=info \
-e TZ=Asia/Tokyo \ -e TZ=Asia/Tokyo \
-e PROXY=<yes|no> \
-p 5055:5055 \ -p 5055:5055 \
-v /path/to/appdata/config:/app/config \ -v /path/to/appdata/config:/app/config \
--restart unless-stopped \ --restart unless-stopped \
@@ -33,7 +32,6 @@ docker run -d \
--user=[ user | user:group | uid | uid:gid | user:gid | uid:group ] \ --user=[ user | user:group | uid | uid:gid | user:gid | uid:group ] \
-e LOG_LEVEL=info \ -e LOG_LEVEL=info \
-e TZ=Asia/Tokyo \ -e TZ=Asia/Tokyo \
-e PROXY=<yes|no> \
-p 5055:5055 \ -p 5055:5055 \
-v /path/to/appdata/config:/app/config \ -v /path/to/appdata/config:/app/config \
--restart unless-stopped \ --restart unless-stopped \

View File

@@ -62,6 +62,9 @@ components:
applicationUrl: applicationUrl:
type: string type: string
example: https://os.example.com example: https://os.example.com
trustProxy:
type: boolean
example: true
csrfProtection: csrfProtection:
type: boolean type: boolean
example: false example: false

View File

@@ -61,7 +61,7 @@ app
startJobs(); startJobs();
const server = express(); const server = express();
if (process.env.PROXY === 'yes') { if (settings.main.trustProxy) {
server.enable('trust proxy'); server.enable('trust proxy');
} }
server.use(cookieParser()); server.use(cookieParser());

View File

@@ -54,6 +54,7 @@ export interface MainSettings {
csrfProtection: boolean; csrfProtection: boolean;
defaultPermissions: number; defaultPermissions: number;
hideAvailable: boolean; hideAvailable: boolean;
trustProxy: boolean;
} }
interface PublicSettings { interface PublicSettings {
@@ -158,9 +159,10 @@ class Settings {
main: { main: {
apiKey: '', apiKey: '',
applicationUrl: '', applicationUrl: '',
hideAvailable: false,
csrfProtection: false, csrfProtection: false,
defaultPermissions: Permission.REQUEST, defaultPermissions: Permission.REQUEST,
hideAvailable: false,
trustProxy: false,
}, },
plex: { plex: {
name: '', name: '',

View File

@@ -30,6 +30,9 @@ const messages = defineMessages({
csrfProtection: 'Enable CSRF Protection', csrfProtection: 'Enable CSRF Protection',
csrfProtectionTip: csrfProtectionTip:
'Sets external API access to read-only (Overseerr must be reloaded for changes to take effect)', 'Sets external API access to read-only (Overseerr must be reloaded for changes to take effect)',
trustProxy: 'Enable Proxy Support',
trustProxyTip:
'Allows Overseerr to correctly register client IP addresses behind a proxy (Overseerr must be reloaded for changes to take effect)',
}); });
const SettingsMain: React.FC = () => { const SettingsMain: React.FC = () => {
@@ -78,6 +81,7 @@ const SettingsMain: React.FC = () => {
csrfProtection: data?.csrfProtection, csrfProtection: data?.csrfProtection,
defaultPermissions: data?.defaultPermissions ?? 0, defaultPermissions: data?.defaultPermissions ?? 0,
hideAvailable: data?.hideAvailable, hideAvailable: data?.hideAvailable,
trustProxy: data?.trustProxy,
}} }}
enableReinitialize enableReinitialize
onSubmit={async (values) => { onSubmit={async (values) => {
@@ -87,6 +91,7 @@ const SettingsMain: React.FC = () => {
csrfProtection: values.csrfProtection, csrfProtection: values.csrfProtection,
defaultPermissions: values.defaultPermissions, defaultPermissions: values.defaultPermissions,
hideAvailable: values.hideAvailable, hideAvailable: values.hideAvailable,
trustProxy: values.trustProxy,
}); });
addToast(intl.formatMessage(messages.toastSettingsSuccess), { addToast(intl.formatMessage(messages.toastSettingsSuccess), {
@@ -170,6 +175,32 @@ const SettingsMain: React.FC = () => {
</div> </div>
</div> </div>
</div> </div>
<div className="mt-6 sm:mt-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-t sm:border-gray-800">
<label
htmlFor="trustProxy"
className="block text-sm font-medium leading-5 text-gray-400 sm:mt-px"
>
<div className="flex flex-col">
<span className="mr-2">
{intl.formatMessage(messages.trustProxy)}
</span>
<span className="text-gray-500">
{intl.formatMessage(messages.trustProxyTip)}
</span>
</div>
</label>
<div className="mt-1 sm:mt-0 sm:col-span-2">
<Field
type="checkbox"
id="trustProxy"
name="trustProxy"
onChange={() => {
setFieldValue('trustProxy', !values.trustProxy);
}}
className="w-6 h-6 text-indigo-600 transition duration-150 ease-in-out rounded-md form-checkbox"
/>
</div>
</div>
<div className="mt-6 sm:mt-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-t sm:border-gray-800"> <div className="mt-6 sm:mt-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:items-start sm:border-t sm:border-gray-800">
<label <label
htmlFor="csrfProtection" htmlFor="csrfProtection"

View File

@@ -475,6 +475,8 @@
"components.Settings.toastPlexRefreshSuccess": "Retrieved Plex server list.", "components.Settings.toastPlexRefreshSuccess": "Retrieved Plex server list.",
"components.Settings.toastSettingsFailure": "Something went wrong while saving settings.", "components.Settings.toastSettingsFailure": "Something went wrong while saving settings.",
"components.Settings.toastSettingsSuccess": "Settings saved.", "components.Settings.toastSettingsSuccess": "Settings saved.",
"components.Settings.trustProxy": "Enable Proxy Support",
"components.Settings.trustProxyTip": "Allows Overseerr to correctly register client IP addresses behind a proxy (Overseerr must be reloaded for changes to take effect)",
"components.Settings.validationHostnameRequired": "You must provide a hostname/IP", "components.Settings.validationHostnameRequired": "You must provide a hostname/IP",
"components.Settings.validationPortRequired": "You must provide a port", "components.Settings.validationPortRequired": "You must provide a port",
"components.Setup.configureplex": "Configure Plex", "components.Setup.configureplex": "Configure Plex",