Creating Responses: Attaching Headers To Responses

Return response($content)
            ->header('Content-Type', $type)
            ->header('X-Header-One', 'Header Value')
            ->header('X-Header-Two', 'Header Value');
Return response($content)
            ->withHeaders([
                'Content-Type' => $type,
                'X-Header-One' => 'Header Value',
                'X-Header-Two' => 'Header Value',
            ]);

You may use the header method to add a series of headers to the response before sending it back to the user.

You may use the withHeaders method to specify an array of headers to be added to the response.

Creating Responses: Attaching Headers To Responses — Structure map

Clickable & Draggable!

Creating Responses: Attaching Headers To Responses — Related pages: