# In-place browser optimization (in_place_optimize_for_browser)

Browser-specific in-place optimization. The in_place_optimize_for_browser filter: what it does, its risks and the Apache, nginx and IIS directives.

Canonical URL: https://modpagespeed.com/docs/filters/in_place_optimize_for_browser/

- Category: Image
- CoreFilters: No
- OptimizeForBandwidth: No
- Risk: Not rated

`in_place_optimize_for_browser` is retired. It used to make the module's own in-place path vary images by the browser's `Accept` header and add `Vary: Accept`; that path now optimizes an image identically for every client, so the filter has nothing left to do. The name is still accepted, with a warning, so an existing configuration keeps loading; it is no longer part of `OptimizeForBandwidth`.

## How it works

Remove it from your configuration.

The filter does not control format negotiation at the original URL. When the optimizer worker is attached (`DaemonSocketPath` and `DaemonVolumePath`, which the Apache packages built to depend on `pagespeed-optimizer` set in `pagespeed_daemon.conf`), in-place images are served from the optimizer's cache in the format the request's `Accept` header selects, with `Vary: Accept`: WebP for `*/*`, `image/*` or no `Accept` header, the original format for a request that names only that format. See [Image format and the Accept header](https://modpagespeed.com/docs/cdn-integration/#image-format-negotiation) for the full rule and how to get the original format for a non-browser client.

## When to use it

- Not in CoreFilters: it runs only when you enable it by name.
- Retired: the name is still accepted (with a warning) but has no effect, because the module's own in-place path optimizes an image identically for every client. It does not control format negotiation: with the optimizer worker attached, in-place images are still served in the format the request's Accept header selects, with Vary: Accept.

## Risks

- None from the filter itself: it has no effect. The `Vary: Accept` considerations for images served from the worker's cache are on the [CDN integration page](https://modpagespeed.com/docs/cdn-integration/#image-format-negotiation).

## Configuration

Enable it in the module configuration, at server, virtual-host or location scope:

**Apache**

```apache
ModPagespeedEnableFilters in_place_optimize_for_browser
```

**nginx**

```nginx
pagespeed EnableFilters in_place_optimize_for_browser;
```

**IIS (pagespeed.config)**

```text
pagespeed EnableFilters in_place_optimize_for_browser
```

Scoping, `ForbidFilters` and the thresholds filters read: [Choosing filters](https://modpagespeed.com/docs/filter-selection/).

## Frequently asked questions

**What does the in_place_optimize_for_browser filter do?**

`in_place_optimize_for_browser` is retired. It used to make the module's own in-place path vary images by the browser's `Accept` header and add `Vary: Accept`; that path now optimizes an image identically for every client, so the filter has nothing left to do. The name is still accepted, with a warning, so an existing configuration keeps loading; it is no longer part of `OptimizeForBandwidth`.

**Is in_place_optimize_for_browser enabled by default?**

No. `in_place_optimize_for_browser` is not in CoreFilters, the default RewriteLevel; it runs only when you enable it by name with `EnableFilters`.

**How do I enable in_place_optimize_for_browser on Apache and nginx?**

Add `ModPagespeedEnableFilters in_place_optimize_for_browser` on Apache or `pagespeed EnableFilters in_place_optimize_for_browser;` on nginx. On IIS, add `pagespeed EnableFilters in_place_optimize_for_browser` to pagespeed.config.

## Related filters

- [`convert_gif_to_png`](https://modpagespeed.com/docs/filters/convert_gif_to_png/): Convert GIF to PNG
- [`convert_jpeg_to_avif`](https://modpagespeed.com/docs/filters/convert_jpeg_to_avif/): Convert JPEG to AVIF
- [`convert_jpeg_to_progressive`](https://modpagespeed.com/docs/filters/convert_jpeg_to_progressive/): Progressive JPEG
- [`convert_jpeg_to_webp`](https://modpagespeed.com/docs/filters/convert_jpeg_to_webp/): Convert JPEG to WebP
- [`convert_png_to_jpeg`](https://modpagespeed.com/docs/filters/convert_png_to_jpeg/): Convert PNG to JPEG
- [`convert_to_avif_animated`](https://modpagespeed.com/docs/filters/convert_to_avif_animated/): Animated AVIF
- [`convert_to_avif_lossless`](https://modpagespeed.com/docs/filters/convert_to_avif_lossless/): Lossless AVIF
- [`convert_to_webp_animated`](https://modpagespeed.com/docs/filters/convert_to_webp_animated/): Animated WebP

This page is drawn from the [in_place_optimize_for_browser entry on Image filters](https://modpagespeed.com/docs/image-filters/#in_place_optimize_for_browser). Every filter in one table: [PageSpeed filters](https://modpagespeed.com/docs/filters/).
