Skip to content

Find a way to enable CORS headers #57

Closed

Description

@michielbdejong
No description provided.

Activity

  1. michielbdejong commented on Nov 24, 2021

    @michielbdejong
    MemberAuthor

    https://github.com/pdsinterop/solid-nextcloud#manual-install instructs the user to enable CORS headers on the entire server, which is overkill and DANGEROUS because it could allow cross-site scripting to other Nextcloud apps if the user is logged in with a cookie.

  2. michielbdejong commented on Nov 24, 2021

    @michielbdejong
    MemberAuthor

    should work with a directory tag, too:
    a2enmod headers and then:

    <Directory /var/www/html>
       ...
       Header always set Access-Control-Allow-Origin *
       ...
    </Directory>
    
  3. michielbdejong commented on Nov 24, 2021

    @michielbdejong
    MemberAuthor

    Putting it in the Directory works for /var/www/html but not if you put it in /var/www/apps/solid because according to apache all requests are handled by /var/www/html/index.php.

  4. michielbdejong commented on Nov 24, 2021

    @michielbdejong
    MemberAuthor

    Maybe we should uncomment https://github.com/pdsinterop/php-solid-crud/blob/b6816c0/src/Server.php#L117-L123
    So then at least all the routes on the storage would get CORS headers and then we would only need to deal with /.well-known/openid-provider separately.

  5. michielbdejong commented on Nov 24, 2021

    @michielbdejong
    MemberAuthor

    Ah, using that ^ and in addition, if you create a static file:

    mkdir -p /var/www/html/.well-known
    curl https://cloud.pondersource.org/index.php/apps/solid/openid > /var/www/html/.well-known/openid-configuration

    Add this to your /etc/apache2/sites-enabled/000-default.conf:

    <Directory /var/www/html/.well-known/>
        Header always set Access-Control-Allow-Origin: *
    </Directory>
    

    and then:

    a2dismod rewrite
    systemctl restart apache

    Then it works! :)

  6. michielbdejong commented on Nov 24, 2021

    @michielbdejong
    MemberAuthor

    Testing this out now... next error:

    Access to fetch at 'https://cloud.pondersource.org/index.php/apps/solid/jwks' from origin 'https://noeldemartin.github.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
    

    So that needs the same edit in https://github.com/pdsinterop/php-solid-auth/blob/b08a3910d49535afd3d77db264badcd564f31f6e/src/Server.php#L148

  7. michielbdejong commented on Sep 27, 2022

    @michielbdejong
    MemberAuthor

    Fixed in #93

  8. Potherca commented on Sep 27, 2022

    @Potherca
    Member

    @michielbdejong Can we close this issue?

  9. michielbdejong commented on Sep 27, 2022

    @michielbdejong
    MemberAuthor

    @Potherca it will be closed automatically when #93 is merged

  10. michielbdejong commented on Sep 27, 2022

    @michielbdejong
    MemberAuthor

    Ah, actually that wasn't true when I wrote it but it is true now :)

  11. added this to the v0.6.0 milestone on Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions