Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

CORS not working after enabling page speed on Apache #2080

Open

Description

@fahadabid

Hi

I have enabled page speed on Apache/2.4.25 (Debian)
Running on
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian

And added settings into the page speed are following
ModPagespeedAddResourceHeader "Access-Control-Allow-Origin" "*"
ModPagespeedAddResourceHeader "Access-Control-Allow-Credentials" "true"
ModPagespeedAddResourceHeader "Access-Control-Max-Age" "28800"
ModPagespeedAddResourceHeader "Access-Control-Allow-Methods" "POST, GET, OPTIONS, PUT, DELETE"
ModPagespeedAddResourceHeader "Access-Control-Allow-Headers" "Content-Type, X-Auth-Token, Origin, Authorization"

Still facing CROS issue

Activity

  1. Lofesa commented on Sep 8, 2021

    @Lofesa
    Contributor

    And what is your CROS issue?

  2. fahadabid commented on Sep 9, 2021

    @fahadabid
    Author

    I have two subdomains one is app.example.com and the other is api.example.com after enabling the page speed module the app can not any endpoint to API from the browser. If the disabled the module it works. The page speed module config is already shown above.

  3. Lofesa commented on Sep 9, 2021

    @Lofesa
    Contributor

    And these urls are rewrited by pagespeed?
    Have you the content-security-policy header in place?
    What error have you in the browser console?

  4. fahadabid commented on Sep 9, 2021

    @fahadabid
    Author

    And these urls are rewrited by pagespeed?
    No, nothing like, I shared if I have to somethings to make it work.

    Have you the content-security-policy header in place?
    No

    What error have you in the browser console?
    Access to XMLHttpRequest at 'http://api.example.com/login' from origin 'http://app.example.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

  5. Lofesa commented on Sep 10, 2021

    @Lofesa
    Contributor

    Hi
    I have found a issue #1794 seems is like yours.
    These issue have no responses, so I don´t know if the user has solved this but you may ask to the user @tuananhzippy about it.
    In this issue the headers set by ModPagespeedAddResourceHeader are not added.
    See the issue #1760 and try changin the ModPagespeedAddResourceHeade directives with the apache config: Header setifempty Access-Control-Allow-Origin <MY_ORIGIN>

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions