Skip to content

GeoIP Redirect Returns 404 Before Store Switching #783

Description

@kavingas

Reproduction Steps

1. Environment Setup

  1. Create two websites in Magento:

    • AU Website (Australia)
    • US Website (United States)
  2. Set the AU website as the default store view

  3. Configure Fastly GeoIP Country Mapping as documented here:

  4. Add the following GeoIP mappings:

    AU ANY AU
    US ANY US
    

2. Product Configuration

  • Create a product associated only with the US store
  • Ensure the product is not available in the AU (default) store

3. Testing Procedure

  1. Open a new browser window
  2. Open browser Developer Tools with Preserve Log enabled to track redirects
  3. Connect to a VPN with a US IP address
  4. Access the product URL directly

Current Behavior (Actual)

The system returns the following sequence of responses:

  1. First Response: HTTP 404 Not Found (from Default Store View - AU)
  2. Second Response: HTTP 302 Found (via /stores/store/switch/)
  3. Final Response: HTTP 200 OK (from US store)

Problem: The 404 status code is returned before the GeoIP redirect occurs, causing SEO problems as search engine crawlers index the 404 error, potentially de-indexing the product.

Expected Behavior

The system should perform an Edge-side redirect (301 or 302) directly to the correct store view based on GeoIP, without:

  • Hitting the Default Store View's routing table
  • Returning a 404 status code

Users and crawlers should be redirected seamlessly to the appropriate store view, and products should remain properly indexed.

Live Example

Test URL: https://store.zyxel.com/atp700-us0102f.html

Instructions:

  • Access this URL using a US VPN IP address
  • Keep browser Developer Tools open to observe the network requests
  • Note the initial 404 response before the redirect

Screen Recording: View recording

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions