Skip to content

Conversation

Copy link

Copilot AI commented Sep 30, 2025

Implements support for three additional Cross-Origin HTTP security headers as requested in #81:

  • Cross-Origin-Opener-Policy (COOP) - Controls whether a document can share a browsing context group with cross-origin documents
  • Cross-Origin-Resource-Policy (CORP) - Controls which origins can load the resource
  • Cross-Origin-Embedder-Policy (COEP) - Prevents loading cross-origin resources without explicit permission

New Configuration Directives

security_headers_coop

security_headers_coop same-origin;
  • Values: unsafe-none, same-origin-allow-popups, same-origin, omit
  • Default: omit
  • Ensures top-level documents don't share browsing context with cross-origin documents
  • Required for enabling powerful browser features like SharedArrayBuffer

security_headers_corp

security_headers_corp same-origin;
  • Values: same-site, same-origin, cross-origin, omit
  • Default: omit
  • Controls which origins can load the resource via <img>, <script>, <link>, etc.

security_headers_coep

security_headers_coep require-corp;
  • Values: unsafe-none, require-corp, omit
  • Default: omit
  • Prevents loading cross-origin resources without explicit CORP permission
  • Works with COOP to enable cross-origin isolation

Example Usage

Enable cross-origin isolation for a secure application:

server {
    listen 443 ssl;
    server_name app.example.com;
    
    security_headers on;
    security_headers_coop same-origin;
    security_headers_corp same-origin;
    security_headers_coep require-corp;
    
    location / {
        # Your application
    }
}

This configuration enables modern browser features that require cross-origin isolation while maintaining security.

Implementation Details

  • All three headers default to omit to avoid breaking existing sites
  • Can be configured at http, server, or location level with proper inheritance
  • Follows the same pattern as existing headers (security_headers_xss, security_headers_frame, etc.)
  • Comprehensive test coverage with 12 new tests
  • Complete documentation in README

References

Fixes #81

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • nginx.org
    • Triggering command: wget -O - REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Request: Additional Cross-Origin headers (COOP CORP, COEP)</issue_title>
<issue_description>Implement new upcoming HTTP Cross-Origin headers.

Sources:

Comments on the Issue (you are @copilot in this section)

Fixes #17

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: dvershinin <250071+dvershinin@users.noreply.github.com>
Copilot AI changed the title [WIP] Feature Request: Additional Cross-Origin headers (COOP CORP, COEP) Add support for Cross-Origin security headers (COOP, CORP, COEP) Sep 30, 2025
Copilot AI requested a review from dvershinin September 30, 2025 15:01
Copilot finished work on behalf of dvershinin September 30, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Additional Cross-Origin headers (COOP CORP, COEP)

2 participants